Simple tutorial for Neo4J and using it with django + python - python

Is there any simple tutorial for learning Neo4J. I went through its official manual and found very confusing for me since i am from mysql background. I just wanted to learn Neo4J but i am really finding a hard time. Also there is not much books available for Neo4J
Please help me with this

I just updated neo4django's documentation, and like to think it reads like a tutorial. I'd appreciate feedback!

Look at the Bulbs Quickstart tutorial (http://bulbflow.com/quickstart/). Bulbs works with any Python Web framework, including Django, Flask, and Pyramid.

There is a nice integration for Neo4j+Django: https://github.com/scholrly/neo4django
and I notice a tutorial on github: https://github.com/johanlundberg/neo4j-django-tutorial
There are a few books in the works, covering general concepts about working with a graph database and Neo4j specifics. But they haven't yet hit the shelves.
For now, the Neo4j manual is the best material available for learning.
-Andreas

neo4django is super outdated. Check the updated options at:
https://neo4j.com/developer/python/
About the tutorial you can find many free resources at the website. You can also start with Cypher, the query language:
https://neo4j.com/developer/cypher/

FYI: neomodel is also beginning to be outdated. It's not compatible with the latest neo-driver version for instance.
It lacks updates, and apart from that, we had some serious threading issues with it - seems like it is not thread safe/not synchronous, or not doing the whole async/sync thing correctly. (since Neo4J is async, and Django is not (yet))
The idea behind these libs was to have some kind of abstraction layer, like an ORM, but what's the point if it is not any more convenient than Cypher, nor can it do everything Cypher can, so you start writing queries in Cypher anyhow. Having something graph database agnostic is also fake, since it only serves Neo4J.
We already rewrote all queries in Cypher, now I just have to find a way to do the data modelling natively.

Related

Flask Custom Login and Template Rendering

I am new to learning Python for web development and have decided to go with Flask as my framework of choice as of now. I have chosen this primarily for its bare-bones approach on web development and I want to make as much of my web app custom and on my own as possible. I have made a very basic MVC framework in PHP and would like to make something like this in Python. I was researching some ways to interact with a database and add user login/register support and my original thoughts were that I wanted to do this all custom with my own methods and objects and what not. Similar to how I have done in PHP, so I can learn as much about developing my own back-end efficiently for long term production projects. In some research I found the basic objects in Flask such as Login Manager, Login-Form and Flask-Admin, etc. I don't like the idea of using these nicely packaged things that I have very little control over and have not dev'd custom.
Using that kind of stuff I also feel that I am not learning how all of that stuff works on the lowest level so I could not reproduce some of the benefits they are giving me later on in life when project circumstances change and maximum flexibility, customization, maintainability, and efficiency is needed. Obviously I am not in that position right now, but I DO know how to write this back end stuff in PHP and am just wondering if that means anything as far as managing sessions and Authentication on my own in Python/Flask, or if my thinking is totally out of ocontext and its not even close to managing the same stuff.
It is a really great idea to learn how authentication works at a low level -- it's particularly important as many people never learn this stuff, and it's quite interesting!
What I'd recommend you do is take a look at the official Flask tutorial (http://flask.pocoo.org/docs/0.10/tutorial/), as it covers a lot of this (working directly with sessions, etc.).
What I would not recommend, however, is using this sort of thing in production.
Using your own authentication code is almost never a good idea -- it's much better to rely on a well supported library that has been audited by other people for security issues.
In the Flask world you've got a couple choices:
Flask-Login: https://flask-login.readthedocs.org/en/latest/
Flask-Security: https://pythonhosted.org/Flask-Security/
Flask-Stormpath: http://flask-stormpath.readthedocs.org/en/latest/
Of those 3, I really like Flask-Stormpath -- but I'm super biased as I wrote it =)
Flask-Stormpath supports the widest array of customization / etc., and allows you to do whatever you want with it.
Hope that helps!
Flask official doc have some app examples. One of them is MiniTwit a micro Twitter clone. As it is a complete app, you could found much of what you're looking for. If you want to make something greater, try Full Stack Python Flask tutorial

how to manage db schema in a python twisted application?

I am over accustomed to Django ORM and feel handicapped when trying to build a standalone python-twisted application which needs database integration.
SQLAlchemy looks promising - true. But I am trying to tinker with twisted as well and am unable to find anything on the lines of a good async python orm.
what I have found (https://stackoverflow.com/a/1705987/338691) would force me to write raw sql queries - doesn't feel quite right after my elongated stint with django.
So how does one play with database schema in a twisted application?
There is also http://findingscience.com/twistar/ which unfortunately follows the Active Record pattern and last time I checked, the author feels that migrations are out of scope of the project. So you would end up writing migrations manually anyway (maybe there could be some adapter for alembic for that, that would be cool).
Also I remember seeing github repo where the author tries to make twisted play nicely with sqlalchemy (without deferToThread) but I haven't followed to see if it was a success and can't find the URL. (also Twisted + SQLAlchemy and the best way to do it)
And lastly, recent versions of psycopg supports setting an async callback. Maybe that could be leveraged to something (integration with SQLAlchemy? or something).
UPDATE: also recently appeared this interesting project - alchimia

which python web framework(django or django-norel or pyramid) to use when MongoDB is used as a database

I am using MongoDB as my primary(and only till now) database and because of google and the links it provided me i am confused between Django or Pyramid.
I am comfortable with python but never done web development in python(i have done in PHP). Now because i will be using Mongo so i wont use Django ORM will that take away the ease of development people associate with Django?
I am new to Django(just a few hours) so i am not sure what parts of the framework the ORM affects.
Or should i go with the django fork django-norel with django mongodb engine (they are not actively maintained though) or should i use Pyramid because i plan to use jinja2 as my template layer so that makes 2 parts of django useless to me.
After removing these batteries from django does it still remain true that it a framework for people with deadlines?
Advice?
A year or two ago I was also deciding between django and pyramid w/ mongodb to build a high performance web application. I ultimately chose Pyramid :
Pros:
Pyramid is very light weight for a full stack framework. There is a minmal amount of 'magic' going on under the hood. I was able to wrap my head around all the pieces.
It is not as opinionated as Django. You can plug and play whatever templating engines or databases you need relatively easily.
I was impressed by the performance benchmarks between Pyramid over other full stack frameworks.
The Pylons/Pyramid culture of 100% code coverage and "only pay for what you eat" was appealing to my own development style.
Cons:
The community is growing, but still not as mature as Django
There's a lot of documentation, but it's not as robust as some of the Django docs out there
The lack of 'magic' and beginner friendly documentation make for a steeper learning curve.
As for using an ORM with MongoDB; I recommend you try building without one at first. After trying a few mongodb ORMs, I've ended up going back to plain pymongo with Colander or Validictory for validation. Pymongo is already very ORM-like, fast, and flexible. I felt the extra layers of abstraction took away from that flexibility, and caused me to write more code than was needed.
I'm going to suggest an alternative that has not been mentioned: Flask. Flask has a really great (albeit smaller than Django) community and there are a lot of extensions available for common web-app extensions, in the extensions directory.
There are several MongoDB extensions for Flask, which help to integrate MongoDB into the framework, but I would also highly recommend the mongoengine ORM. One of the people working on mongoengine has release an extension for Flask integration, Flask-MongoEngine.
Try it all (Django, Pyramid, Flask), read the docs, and you done.
If you will select Django, you will not use some parts of it (orm, formlib), and that is all.
ALso see this video:
https://www.10gen.com/presentations/mongosf-2011/mongodb-with-python-pylons-pyramid

library management system in django

I just started developing library management system using django. I'm new to Django, so where do you suggest me to start? I used the tutorial on django's website but I think it's not enough for me to do something like this.
I will probably use this ER diagram of database of the system, but probably I should transfer it into django model, right?
Anything more you can suggest me it will mean a lot for me. Thanks
I firmly recommend starting with this tutorial:
https://docs.djangoproject.com/en/dev/intro/tutorial01/
What you gonna do then is just use more models than they have in tutorial. The idea is - you describe you domain with classes called "models". Each of them describes an entity from your domain. You also describe their relations and that's it. That's the idea.

Good resources to start python for web development?

I'm really interested in learning Python for web development. Can anyone point me in the right direction? I've been looking at stuff on Google, but haven't really found anything that shows proper documentation and how to get started. Any recommended frameworks? Tutorials?
I've been doing PHP for 5 years now, so I just want to try something new.
Django is probably the best starting point. It's got great documentation and an easy tutorial (at http://djangoproject.com/) and a free online book too (http://www.djangobook.com/).
Web Server Gateway Interface
About
http://www.wsgi.org/en/latest/index.html
http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
Tutorials
http://webpython.codepoint.net/wsgi_tutorial
http://lucumr.pocoo.org/2007/5/21/getting-started-with-wsgi/
http://archimedeanco.com/wsgi-tutorial/
There are three major parts to python web frameworks, in my experience. From the front to back:
Views/Templates: Application frameworks don't function as independent scripts - instead, you map paths to python functions or objects which return html. To generate the html you probably need templates (aka views). Check out Cheetah.
Application framework/Server: There are plenty. CherryPy is my favorite, and is good for understanding how a python application server works because a) it's simple and b) unlike django and others, it is just the application server and doesn't include a templating engine or a database abstraction layer.
Database layer: I've actually never used it, but everyone seems to like SQLAlchemy. I prefer, in simple applications, executing SQL directly using a tool like psycopg2 (for postgres).
You can try Django. It's easy to learn, and it works with GAE (though the default version is 0.96, a little bit old, but you can change it). And there's a video about rapid development (by Guido Van Rossum) that goes through the basics of setting up a Django project in App Engine.

Categories

Resources