django-nonrel / django Goto Github PK
View Code? Open in Web Editor NEWThis project forked from django/django
Django fork with support for NoSQL databases
Home Page: http://www.django-nonrel.org/
License: BSD 3-Clause "New" or "Revised" License
This project forked from django/django
Django fork with support for NoSQL databases
Home Page: http://www.django-nonrel.org/
License: BSD 3-Clause "New" or "Revised" License
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. All documentation is in the "docs" directory and online at http://docs.djangoproject.com/en/dev/. If you're just getting started, here's how we recommend you read the docs: * First, read docs/intro/install.txt for instructions on installing Django. * Next, work through the tutorials in order (docs/intro/tutorial01.txt, docs/intro/tutorial02.txt, etc.). * If you want to set up an actual deployment server, read docs/howto/deployment/index.txt for instructions. * You'll probably want to read through the topical guides (in docs/topics) next; from there you can jump to the HOWTOs (in docs/howto) for specific problems, and check out the reference (docs/ref) for gory details. * See docs/README for instructions on building an HTML version of the docs. Docs are updated rigorously. If you find any problems in the docs, or think they should be clarified in any way, please take 30 seconds to fill out a ticket here: http://code.djangoproject.com/newticket To get more help: * Join the #django channel on irc.freenode.net. Lots of helpful people hang out there. Read the archives at http://django-irc-logs.com/. * Join the django-users mailing list, or read the archives, at http://groups.google.com/group/django-users. To contribute to Django: * Check out http://www.djangoproject.com/community/ for information about getting involved. To run Django's test suite: * Follow the instructions in the "Unit tests" section of docs/internals/contributing.txt, published online at https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests
Any plans on Django 1.8?
I'm trying to install django-nonrel with mongodb support, below installed packages
git+https://github.com/django-nonrel/[email protected]
git+https://github.com/django-nonrel/djangotoolbox # v1.8.0
git+https://github.com/django-nonrel/mongodb-engine # v0.6.0
pymongo==3.1
mongoadmin==0.2
mongodbforms==0.3
mongoengine==0.10.0
and my settings file is as follow:
INSTALLED_APPS = (
# 'django.contrib.admin',
# 'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djangotoolbox',
)
and for db settings:
DATABASES = {
'default' : {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'mydb',
'HOST': 'mongo'
}
}
When I run manage.py syncdb
, I got this error:
NotImplementedError: subclasses of BaseDatabaseIntrospection may require a get_table_list() method
and if I run manage.py
without specifying any command, I got:
ImportError: No module named django
However django is installed and the pythonpath is properely configured
When I run the tests for Django 1.4 in an AppEngine project, I get about 20 failures/errors. Prior to version 1.4, all tests passed.
The failures are all in contrib.auth, contrib.contenttypes, and contrib.sessions. The errors are mostly "This query is not supported by the database" and "Only strings and positive integers may be used as keys on GAE."
Has Django-nonrel 1.4 been tested much against GAE? Are these tests expected to pass, or do they need qualifiers (I know many tests are already marked as "requiring JOIN support") so that they'll be skipped on GAE?
I'm happy to help get them running properly if needed; just want to see what the state is expected to be and make sure this isn't due to actual misconfiguration in my project.
Both the mongodb-engine and the djangoappengine installation pages reference the 1.5 branch from GitHub. From what I can tell and based on a response on the mailing list, 1.6 is stable now, and if so that should be the recommended version.
More generally, the documentation somewhere should say something about the stability of the various version branches. Apparently 1.7 isn't "ready for prime time" yet but that should be more clearly stated somewhere.
I'm trying to install this library using the command given below:
pip install git+https://github.com/django-nonrel/[email protected]
but It gets stuck on this
Collecting git+https://github.com/django-nonrel/[email protected]
Cloning https://github.com/django-nonrel/django (to nonrel-1.5) to /var/folders/wn/klm7h6757yj5lj60zdk7w2bw0000gn/T/pip-90prjk0m-build
Is version 1.6 the last release? Any plans for any future releases?
Thank you. :)
Hi,
I've forked the repo to upgrading it to 1.5.x, But there's a nonrel-1.5-beta branch that I've not tested it yet.
I would like to know if there's any guide, tips or any other kind of todo-list to help me start working upgrading 1.5.x part.
Thanks,
I was trying to perform the openration __range
but it raised this exception
DatabaseError: MongoDB does not support month/day queries.
Also from the documentation we can see that the only QuerySet methods available is :
__year
Is there a way to filter on a Month or Day and time ?
I tried to update to Django 1.6 from 1.5.5. Mostly works, except when I try to do a search in User admin. The default searches for email iexact. Django gives me the 'Lookup type 'iexact' isn't supported.' error.
I am using djangoappengine and dbindexer. Dbindexer does load the __iexact field into the db. The
register_index(User, {
'username': 'iexact',
'email': 'iexact',
})
does seems to register. But, this version of Django 1.6.11 does not like the iexact.
Traceback:
File "/libs/django/core/handlers/base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
return self.admin_site.admin_view(view)(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return view(request, _args, *_kwargs)
return bound_func(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return func(self, _args2, *_kwargs2)
'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
self._fetch_all()
self._result_cache = list(self.iterator())
for row in compiler.results_iter():
results = self.build_query(fields).fetch(
query.add_filters(self.query.where)
self.add_filter(field, lookup_type, self._negated, value)
return func(_args, *_kwargs)
lookup_type)
Exception Type: DatabaseError at /admin/auth/user/
Exception Value: Lookup type 'iexact' isn't supported.
Thanks
Django version 1.5
Backend: Mongodb
save()
call on models does not work correctly with update_fields...It still saves all the fields in a model. Looking at the code at ~/django/db/models/base.py in save_base
, it seems that the param distinguishes_insert_from_update
makes the code attempt inserts everytime and hence it forgets to take care of the fields specified in update_fields
.. What can be the work around?
Posting my question from stack overflow - http://stackoverflow.com/questions/31442632/django-nonrel-with-existing-legacy-database.
Sorry about filing an issue but I tried to attach the label "question" but was not successful in doing so. Please point me in the right direction if this is against community guidelines.
We have a large existing database and I am using django-nonrel to write an app on it. As far as possible I want to avoid using the pymongo interface to talk to the database.
I used the meta tag db_table to point to the existing collection and executed syncdb without any issues. I can see the collection in the admin view and .objects.all.count() returns the expected value but all the entries are none.
When I try to open an entry from admin view to edit/view it I get error -
AutoField (default primary key) values must be strings representing an ObjectID on MongoDB (got u'' instead)
When I googled I found this solution http://django-mongodb-engine.readthedocs.org/en/latest/troubleshooting.html but this doesnt look like the site ID issue as the value of _id from my mongo database.
Any pointers will be really helpful as replicating the data is not an option.
Thanks Aditya
Using version 1.6.8 I get the following error when running tests
Traceback (most recent call last):
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 187, in call
self._post_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 796, in _post_teardown
self._fixture_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 889, in _fixture_teardown
return super(TestCase, self)._fixture_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 817, in _fixture_teardown
inhibit_post_syncdb=self.available_apps is not None)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/init.py", line 159, in call_command
return klass.execute(_args, *_defaults)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 79, in handle_noargs
six.reraise(CommandError, CommandError(new_msg), sys.exc_info()[2])
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 67, in handle_noargs
savepoint=connection.features.can_rollback_ddl):
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/db/transaction.py", line 251, in enter
"The outermost 'atomic' block cannot use "
CommandError: Database test_patent_litigation couldn't be flushed. Possible reasons:
according to this post http://stackoverflow.com/questions/28520599/django-nonrel-mongodb-error-while-running-tests it runs with 1.5. Looking at djangos doc, 1.6 changed transaction behavior
https://docs.djangoproject.com/en/1.6/topics/db/transactions/
Changed in Django 1.6:
Before Django 1.6, autocommit was turned off, and it was emulated by forcing a commit after write operations in the ORM.
So I guess that's the reason of this issue.
I guess its because when fork was taken a bug existed in django 1.7.1
related fixes and tickets
https://github.com/django/django/pull/3425/files
https://code.djangoproject.com/ticket/23717
This is possibly mongodb focussed but I don't have enough knowledge of other nonrel dbs to make that call. We're using mongodb so are using djangotoolbox and mongodb-engine.
In the case that another part of our system has modified a document in our collection and our django model isn't totally up to date with the full schema when we save from django we lose the changes made by the other part of the system.
When calling save on a django model I have discovered that we end up using the NonrelInsertCompiler
which in most cases isn't really a problem. However in the case that another part of our system has modified the document in our collection and our django model isn't totally up to date with it's schema when we save from django we lose the changes made by the other part of the system. This could also manifest under a simple race condition.
If I was hand writing the db logic, I would be using an update with the $set
operator to set the fields. I can see that the NonrelUpdateCompiler
seems to do this, so I figured I could probably use the force_update
parameter on the save
call:
model.save(force_update=True)
but it still ended up doing an insert. So having stepped through the code I can see that the distinguishes_insert_from_update
is set to False in the NonrelDatabaseFeatures
class.
Happy to look into how to get this working. I believe it should work this way, but would like some input/guidance from others first.
The problem discussed here has been raised by so many users and they have been working with workarounds. But that is not the solution to it.
omab/django-social-auth#364
Error:
DatabaseError at /admin/default/usersocialauth/
This query is not supported by the database.
I have used python-social-auth with django-mongodb-engine
Error during template rendering
In template /home/chaitanya/venv/local/lib/python2.7/site-packages/django/contrib/admin/templates/admin/change_list.html, error at line
This query is not supported by the database. {% admin_list_filter cl spec %}
{{ cl.formset.non_form_errors }}
{% endif %}
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
{% block search %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
{% block filters %}
{% if cl.has_filters %}
<div id="changelist-filter">
<h2>{% trans 'Filter' %}</h2>
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor%}
</div>
{% endif %}
{% endblock %}
<form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}
{% block result_list %}
Some workaround has been discussed here:
http://stackoverflow.com/questions/13138816/django-admin-filters-and-mongodb-caught-databaseerror-while-rendering-this-que/13193947#13193947
I just updated my django nonrel to version 1.4. and I am using MongoDB as database. When I run a syncdb in a new database (No problem if I use my previous database) or when I run the tests it fails as if I didn't configure the SITE_ID in settings. The problem is that, when I perform this actions, django tries to create the default site using 1 as pk. as can be seen in the following code included in the file lib/python2.7/site-packages/django/contrib/sites/management.py
def create_default_site(app, created_models, verbosity, db, **kwargs): # Only create the default sites in databases where Django created the table if Site in created_models and router.allow_syncdb(db, Site) : # The default settings set SITE_ID = 1, and some tests in Django's test # suite rely on this value. However, if database sequences are reused # (e.g. in the test suite after flush/syncdb), it isn't guaranteed that # the next id will be 1, so we coerce it. See #15573 and #16353. This # can also crop up outside of tests - see #15346. if verbosity >= 2: print "Creating example.com Site object" Site(pk=1, domain="example.com", name="example.com").save(using=db) # We set an explicit pk instead of relying on auto-incrementation, # so we need to reset the database sequence. See #17415. sequence_sql = connections[db].ops.sequence_reset_sql(no_style(), [Site]) if sequence_sql: if verbosity >= 2: print "Resetting sequence" cursor = connections[db].cursor() for command in sequence_sql: cursor.execute(command) Site.objects.clear_cache()
I fixed it in my version just changing the pk of the default site, but I think this could be a problem
Hi,
I'm looking into using Django with MongoDB. I have noticed that this doesn't work properly with Django 1.6.2.
I was wondering if there will be a update soon that will make this possible?
Kind regards,
Raoul
I'm switching from mongoengine to mongodbengine (nonrel) hoping to become more standardized, but something that worked in the old system doesn't with the current 1.4 branch.
In a view I'm trying to link up a child object to a parent and this code doesn't create the foreign key link...
(model.py)
class Child(Model):
a = ...
class Parent(Model):
child = ForeignKey(Child, null=True)
(view.py)
if not parent.child:
parent.child = Child()
parent.child.a = ...
parent.child.save()
parent.save()
I get a new child object with the attribute a set, but the parent doesn't have the ID of the new child object in the child attribute (it has null). But this version does work.
if not parent.child:
child = Child()
else:
child = parent.child
child.a = ...
child.save()
parent.child = child
parent.save()
No idea why, but I assume there is a subtle bug here. And as I said with Django 1.4.2 and mongoengine (+ parts) it worked fine.
I installed this and wanted to test by manage.py help
, however, it raises error, saying:
Usage: manage.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
--version show program's version number and exit
-h, --help show this help message and exit
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/core/management/__init__.py", line 376, in execute
sys.stdout.write(self.main_help_text() + '\n')
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/core/management/__init__.py", line 240, in main_help_text
for name, app in six.iteritems(get_commands()):
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/conf/__init__.py", line 50, in _setup
self._configure_logging()
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/conf/__init__.py", line 72, in _configure_logging
from django.utils.log import DEFAULT_LOGGING
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/utils/log.py", line 7, in <module>
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/views/debug.py", line 12, in <module>
from django.template import Template, Context, TemplateDoesNotExist
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/template/__init__.py", line 53, in <module>
from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/template/base.py", line 19, in <module>
from django.utils.html import escape
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/utils/html.py", line 14, in <module>
from .html_parser import HTMLParser, HTMLParseError
File "/home/erayerdin/.venv/eshot-api/lib/python3.5/site-packages/django/utils/html_parser.py", line 12, in <module>
HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
I realized that this is Django 1.6.x and I upgraded that, then it is solved.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.