Using Neo4j and MongoDB together in a CPython framework - django

Well, here is my problem, I'll make an e-commerce project for my thesis, I'll make it using Django, and I wanna use NoSql solution, since I'll imagine that this e-commerce website will grow (...) the idea of that website is a social-e-commerce without money transactions, I'll use two solutions: MongoDB to store users information (since it's a schema-free) and Neo4j to make relations between users.
Ok, maybe someone will say: why not using Neo4j to handle everything since Neo4j is also a schema-free, but because it's Django, so I said that something that is a C-program will be better and faster for the web application than a 100% Java solution (when dealing with C-Django), I'll use CPython and not Jython, and I've installed JPype, so I imagine that calling Java from Python is something that will take time?
So my question is:
is it better to use that solution: _id123456789012 is a (friend/best client/best seller...) with _id122234567890 as you can see the _id is generated from mongodb (the harder work) but only the relations are made using neo4j, so all the 80% of the work is done from mongoDB, or do i make everything with one of them: neo4j or mongo?
second, if the solution of using both, how about scaling? from the graph that speaks about NoSql it seems that Neo4j is the latest in Scaling in size (while the best in Scaling in complexity) so will there a problem of "synchronizing"?

It looks like the question has been answered in the comments, so I'm providing this answer to allow the question to show up as being answered.

Related

Django-nonrel Status

Is Django-nonrel still active? I am interested on developing an e-commerce website that involves tons of catalogs and it seems like NoSQL is the best approach for this. I have background in Django but from what I found out, vanilla Django does not support NoSQL.
Enter the Django-nonrel as the alternative. However I am a bit concerned on the project continuity and community. Django-nonrel is a forked of Django 1.3, does this mean that it us outdated (since current Django is 1.5), or does it has its own circle and version after the fork?
In short, what is the status of Django-nonrel? Active?
This was recently discussed here:
http://www.reddit.com/r/django/comments/1cdrqs/using_mongodb_with_django_whats_the_status/
where the following stands out:
"It does not exist yet. And I'd strong recommend not using MongoDB unless you have a good use-case for it. Needing lots of reads/writes in some parts isn't enough to justify it IMO. MongoDB's read/write performance falls back down to earth once it's put in a real world scenario.
...
Disclaimer: I'm a dev working on a series of MongoDB apps that service hundreds of thousands of users and wish very much my predecessors just went with Postgres."
Yes it is, I am using for a year now and is working fine, the only downside, at least for me is that you can't do contains search.
If you want to change ideas please let me know.
django-nonrel is not active now, I´m testing the last version, it´s a django 1.6.11 fork
git+https://github.com/django-nonrel/django#nonrel-1.6
working with postgre and mongodb as DB engines simultaneously and it works

django built-in support for MongoDB

I'm trying to find any information if official django is going to support any noSQL DBMS, especially MongoDB. I found a fork of django 1.3 the django-nonrel (a fork of official django) and some other not very reliable projects (failures occur often, according to comments I found on the web). Is django going to support noSQL officially at all?
Perhaps, there are other ways to achieve your goals, besides going noSQL.
In short, if you just need dynamic fields, you have other options. I have an extensive writeup about them in another answer:
Entity–attribute–value model (Django-eav)
PostgreSQL hstore (Django-hstore)
Dynamic models based on migrations (Django-mutant)
Yes, that's not exactly what you've asked for, but that's all that we've currently got.
As you said, forked code is never the best alternative: changes take longer to get into the fork, it might break things... And even with django-nonrel, is not really Django as you loose things like model inheritance, M2M... basically anything that will need to do a JOIN query behind the scenes.
Is Django going to support NoSQL? As far as I know, there's no plans on the roadmap for doing so in the short run. According to Russell Keith-Magee on his talk on PyCon Russia 2013, "NoSQL" is on the roadmap but in the long term, as well as SQLAlchemy. So if you wanna wait, is going to take a long time, I'm afraid.
Anyway, even if it's not ideal, you still can use Django but use something else as a ORM. Nothing stops you from use vanilla Django and something like MongoDB instead of Django ORM.

django or yii for building a production web app with db and with custom forms and reports [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am trying to choose between django and yii for scalable, maintainable enterprise grade web-app with a database (preferably mysql) backend. The app is mainly focused with data entry but with custom workflows (beyond your basic autogenerated crud forms ) and custom reports. I have a CS background, familiar with MVC, programming background in c++, C#. 8 years ago built a similar app using php, mysql, perl/cgi and remember it being painful (doing everything from scratch with steep learning curve). Need to learn either python or php syntax again but I pick up languages fairly quickly. Read extensively online about django vs yii. Cannot go the .net mvc route due to need for open source. Dabbled in RoR , loved the language but i am not very comfortable with the magic that happens yet, especially for a production grade app. May be in the future. So back to Django vs yii -
Decision factors are:
1) easier learning curve
2)better suited framework for specific tasks that I would need - heavy db manipulations, custom UI flow (nothing too gfx intensive, just regular form elements but where i need to manipulate data over multiple tables via joins etc)
3)no nasty surprises with db connects (read but not fully understood all the gotchas with django orm and mysql).
4) something where I am not fighting the framework/language for basic things
5) scalable and fast run time (i know lot depends on how one architect the solution)
Please advice. Looking for help from someone familiar with having worked in both frameworks. thanks a lot
I know this is old but I feel like I can add to this, having used both frameworks.
Yii is a solid, fast framework. It isn't quite as secure out of the box as Django due to certain things (cross-site request forgery protection, for example) not being enabled or enforced by default. For me the single biggest advantage was the built-in code generator, because once you figure it out and start using it, it basically spits out a full-featured CRUD application in minutes.
Django is my framework of choice, because Python is Django's single biggest advantage. Not busting on PHP, I actually really like the language, but Python's clean object-oriented-ness (that a word?), class inheritance, etc. really shines with a framework like Django. There is no built-in code generator in Django, which was a deliberate choice by the developers. That is both a strength and a weakness. Yii's code generator can become a bit of a crutch if you're really trying to learn the framework, but with Django, once you learn how it works, you can go in and change anything, because you built it yourself, and it forces you to learn the framework well. With Yii, when you have your generated code and have to do a customization, THEN you may quickly begin fighting the framework.
Django's ORM is highly flexible, I'm a SQL guy myself and I think I've used raw SQL in my applications exactly once. Yii's is pretty good but I give Django a leg up in this regard as well, and Django's is extremely well documented.
Installation of Yii is slightly easier than Django, in my experience. Django takes a bit more work to get up and running. Django's tutorial is much, much stronger than that of Yii, at least it was when I started.
My suggestion would be Django. Forms in Django are classes, and of all the frameworks I've worked in over the past 16 years, from classic ASP to .NET, Rails and Java, I'd put Django's way of doing forms up against any of them.
South makes it ridiculously simple to do schema and data migrations.
I would recommend using Postgres over MySQL, especially if you're going to be leveraging Django ORM, as it's a bit more fine-tuned for Postgres. If you don't need Django admin and you have to use MySQL, you might take a look at SQLAlchemy and Alembic.
Django's learning curve is very flat. It's incredibly easy to learn and is extremely well documented.
My $0.02.
Yii is superb. I could learn it and get going within a couple of hours. I struggled to setup Django because of confusing configuration and URL mapping that is needed to get anything working. I have no doubt Django is excellent once you learn it but in my experience Yii was a lot easier to learn.
I really wish someone would port Yii to python.
Here are some comparisons on both frameworks...
http://blog.leehsueh.com/2010/03/django-vs-yii/
http://vschart.com/compare/yii/vs/django-framework

Django and Neo4j without Neo4Django

I'm build a Django app with Neo4j (along with Postgres), I found this Django integration called neo4django, I was wondering if it's possible to use neo4restclient only, like, what would be the disadvantages of not using Neo4django? Does using neo4-rest-client only, give me more flexibility?
When I was creating my models with Neo4Django, it seemed that there is no difference between modeling a graph db and relational db. Am I missing anything?
Thanks!
You can absolutely go ahead with neo4j-rest-client or py2neo, without using neo4django. In the same way, you can use any other database driver you'd like any time using Django, any REST client, etc.
What'll you lose? The model DSL, the built-in querying (eg, Person.objects.filter(name="Mohamed")), the built-in indexing, and the Lucene, Gremlin and Cypher behind that. Some things will be much easier- like setting an arbitrary property on a node- but you'll need to learn more about how Neo4j works.
You'll also lose some of the shortcuts Django provides that work with neo4django, like get_object_or_404() and some of the class-based views that work with querysets.
What'll you gain? Absolute power over the DB, and an easier time tweaking DB performance. Though neo4django isn't nearly as good a lib as some traditional ORMs in the Python sphere, the trade-off of power vs provided ease is similar.
That said, the two can work together- you can drop down from neo4django to the underlying REST client nodes and relationships anytime. Just use model_instance.node to get the underlying neo4j-rest-client node object from a model, and from neo4django.db import connection to get a wrapped neo4j-rest-client GraphDatabase.
On whether you're missing something: neo4django was written to re-use a powerful developer interface- the Django ORM- so it should feel similar to writing models for Postgres. I've written a bit about that odd feeling in the past. I think part of the problem might be that the lib doesn't highlight the graph terminology new graph-interested devs expect- like traversals and pattern matching- and instead dresses those techniques in Django query clothing.
I'd love your thoughts, or to know anything you'd like the library to do that it isn't doing :) Good luck!

Django or Zope?

I want to create a website and I am confused which web framework to use. Please recommend me which framework is better: Django or Zope. I am using Python.
If you mean plain Zope2 by zope then I'd go for Django. Most interesting stuff in the Zope world takes place with either Plone or Grok (which is Zope3, which is actually quite different from Zope2).
Grok works nice with relational databases, Plone doesn't really, so if you depend on an RDBMS, either go with Grok or Django.
Zope and Plone have a rather steep learning curve so you'll get started more quickly with Django.
The largest downside about Django is, in my opinion, that it tries do do everything by itself (templating, object publishing, ORM, and so on) while there are many excellent existing components out there. If you want to be able to use your code / knowledge outside of the web framework you're using, consider Pylons or BFG
Many options, no clear answer, sorry :)
I have no idea what sort of website you're trying to create, so it's hard to recommend a specific framework.
I'd recommend getting through some tutorials to see which one you like best (There's also pylons and TurboGears to pick from).
Django seems to be the most popular starting kit these days though.
If your website is very hierarchical and needs fine grained permissions, I'd use Zope. (Don't use Zope if you intend to store your data almost exclusively in an SQL database.)
If you have large datasets that can be put into (sql)tables and need many forms, I'd use Django. (Don't use Django if you need very fine grained access control, and hierarchical data)
You see: both have their weaknesses and strengths (although I am only developing in Django these days. The Zope community seems to be a bit in dispute these days about the way it should develop)
Zope is dead. As is TurboGears, Pylons, BFG, Repoze, CherryPy etc.
Active and popular Python web frameworks include:
* django
* flask
* bottle
Big, medium and small. Take your pick.
Here is a good comparison of Django and Zope (and Rails)
http://cd-docdb.fnal.gov/cgi-bin/RetrieveFile?docid=2715;filename=Comparison.html;version=3
They preferred Django. I, personally, use Django too, so I don't know much about Zope.
Another good thing about Django is that they have very good documentation (though I don't know that of Zope). Many people praise that very much.
Also I found Django quite easy to use, and also they have a ready 'administrator panel', which allows quick web-oriented site management from the first steps. More important for me, however, is its fine integration with python and the simple organisation (in the link above they complained that Zope uses very much of its own features, while Django is closer to pure Python).
If you are starting from scratch I will suggest you should go for Django. You will get lots of features and suppost from django. Easy to debug and best suited for rapid developement. In the other hand, You should only choose Zope, if you have experienced developers familiar with Zope or have existing projects based on Zope and the cost of switching is too high for the potential value gain.
In zope's website it self it is written, It is no longer recommended to start new projects based on it, unless you are intimately familiar with the technology stack.