django: django 1.2 on ubuntu lucid - django

I am trying to run django on my ubuntu lucid, but I get the following:
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 209, in execute
translation.activate('en-us')
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 66, in activate
return real_activate(language)
File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 36, in delayed_loader
return getattr(trans, real_name)(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 193, in activate
_active[currentThread()] = translation(language)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 176, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/gruszczy/Programy/bozorth/../bozorth/notifications/__init__.py", line 2, in <module>
from django.db.models.signals import post_save
File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py", line 75, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py", line 92, in __getitem__
conn = backend.DatabaseWrapper(db, alias)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py", line 154, in __init__
super(DatabaseWrapper, self).__init__(*args, **kwargs)
TypeError: __init__() takes exactly 2 arguments (3 given)
I have created and empty project and only changed database settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'test.db3', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
Am I lacking some dependency?

try to define databases in Multiple database format

Related

TypeError: connect() argument 4 must be str, not WindowsPath . /*The Error that i m getting in my simple login django project*/

System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
February 17, 2021 - 19:52:27
Django version 3.1.6, using settings 'felix.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
C:\Users\FELIX\OneDrive\Desktop\Projects\django login2\felix\felix\settings.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
self.run()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
self.check_migrations()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 459, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
self.build_graph()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 216, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\recorder.py", line 77, in applied_migrations
if self.has_table():
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\recorder.py", line 55, in has_table
with self.connection.cursor() as cursor:
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 259, in cursor
return self._cursor()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 235, in _cursor
self.ensure_connection()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
self.connect()
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\mysql\base.py", line 234, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\FELIX\AppData\Local\Programs\Python\Python39\lib\site-packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
TypeError: connect() argument 4 must be str, not WindowsPath
I got similar error information while doing makemigrations, and str() worked.
# BASE_DIR = Path(__file__).resolve().parent.parent
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': str(BASE_DIR / 'my.cnf')
}
}
}
TypeError: connect() argument 4 must be str, not WindowsPath, parece referirse a que la línea 4 de la conexión tiene un formato no estándar para el path, solo es revisar el formato de la conexión a DB, por ejemplo:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'project_django_1',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 3306,
}
}
when you are using mysql you do not needed to give the path just creat database and put the name of database
'ENGINE': 'django.db.backends.mysql',
'NAME': 'your-database-name',
Have you set mysql Database setting?
Please check you set DATABASE right.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER': 'mysql username',
'PASSWORD': 'mysql user password',
'HOST': '127.0.0.1',
'PORT': 3306,
}
}

Django Test error AttributeError: 'tuple' object has no attribute 'setdefault'

I am trying to run tests in django which are placed in tests folder.Following is the output.
python manage.py test
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management __init__.py", line 272, in fetch_command klass = load_command_class(app_name,subcommand)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 75, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py",line 40, in import_module __import__(name)
File "/usr/local/lib/python2.7/dist-packages/south/management/commands __init__.py", line 10, in <module> import django.template.loaders.app_directories
File "/usr/local/lib/python2.7/dist-packages/django/template/loaders /app_directories.py", line 23, in <module> mod = import_module(app)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module __import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 6, in <module> from django.contrib.admin.sites import AdminSite, site
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py", line 4, in <module> from django.contrib.admin.forms import AdminAuthenticationForm
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/forms.py", line 6, in <module> from django.contrib.auth.forms import AuthenticationForm
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/forms.py", line 17, in <module> from django.contrib.auth.models import User
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 48, in <module> class Permission(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 96, in __new__new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 264, in add_to_class value.contribute_to_class(cls, name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 124, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 196, in __getitem__self.ensure_defaults(alias)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 174, in ensure_defaults conn.setdefault('ATOMIC_REQUESTS', False)
AttributeError: 'tuple' object has no attribute 'setdefault'
Can some one help me with this ?
I have tried solving by checking the enviornment and i think its correct.Tests run good in production with same enviornment.
Database Settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2'
'NAME': 'projectx',
'USER': 'xyz',
'PASSWORD': 'xyz',
'HOST': '127.0.0.1',
'PORT': '',
}
}
if 'test' in sys.argv:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test_project',
'USER': 'xyz',
'PASSWORD': 'xyz',
'HOST': '127.0.0.1',
'PORT': '',
},
You have a stray comma after the end of your test DATABASES dict, which turns it into a single-item tuple. Remove that final comma.

Django 1.8 create table before reference django_content_type and then fails

I'm trying to create ContentType reference (https://docs.djangoproject.com/en/1.8/ref/contrib/contenttypes/#generic-relations)
myobj/models.py:
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class TaggedItem(models.Model):
tag = models.SlugField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
When I start the test (manage.py test -v3), I get traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/home/alexander/.local/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
old_config = self.setup_databases()
File "/home/alexander/.local/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
**kwargs
File "/home/alexander/.local/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/home/alexander/.local/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
test_flush=True,
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/home/alexander/.local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 317, in sync_apps
cursor.execute(statement)
File "/home/alexander/.local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/alexander/.local/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/alexander/.local/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: ERROR: reference "django_content_type" does not exist
my settings.py:
...
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'myobj',
)
...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mydb', # Or path to database file if using sqlite3.
'USER': 'user', # Not used with sqlite3.
'PASSWORD': 'pass', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
'TEST_NAME': "testdb_%i_%i" % (random.randrange(1,1000000),random.randrange(1,10000000)),
}
}
...
Postgresql log:
ALTER TABLE "myobj_taggeditem" ADD CONSTRAINT "myob_content_type_id_708726b4e928b107_fk_django_content_type_id" FOREIGN KEY ("content_type_id") REFERENCES "django_content_type" ("id") DEFERRABLE INITIALLY DEFERRED
ERROR: reference "django_content_type" does not exist
If I change DB engine to SQLite everythink is ok.
Whats wrong with it?
I'm using django 1.8
You must create migrations for your myobj app. An unmigrated app cannot depend on a migrated app.
Simply run python manage.py makemigrations myobj and it will create the initial migrations for your app.
The reason it "works" on SQLite3 is that foreign key constraints are not enforced in SQLite by Django.

django.core.exceptions.ImproperlyConfigured: name must be an instance of basestring

I am trying to use Mongodb with in my Django.
Below there are connection settings in settings.py
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email#example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 27017,
}
}
when I am trying to run python manage.py syncdb I am getting an error like this:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 59, in handle_noargs
tables = connection.introspection.table_names()
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/base.py", line 76, in table_names
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/base.py", line 106, in __getattr__
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/base.py", line 133, in _connect
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/mongo_client.py", line 1025, in __getitem__
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/mongo_client.py", line 1014, in __getattr__
File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/database.py", line 74, in __init__
django.core.exceptions.ImproperlyConfigured: name must be an instance of basestring
i am using django 1.3
thanks in advance
I've never used mongodb with django, but I'll take a stab just by following the trace. You need to add a value to the NAME setting in your DB configuration
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'foobar',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 27017,
}
}
The error is being thrown here in pymongo which is created around here via django_mongo_engine

Can not run syncdb with Django and mongoDB

I get django-nonrel, djangotoolbox and mongodbengine from github, and the setting.py is as following:
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'admin', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
)
ROOT_URLCONF = 'ptl.urls'
TEMPLATE_DIRS = ('/Users/bxshi/PycharmProjects/ptl/templates',)
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
)
Except that settings.py, I do not have any other .py file in my project.
The error I got is that:
BaoxuShis-MacBook:ptl bxshi$ python manage.py syncdb
Creating tables ...
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/Library/Python/2.7/site-packages/django/contrib/contenttypes/management.py", line 11, in update_contenttypes
content_types = list(ContentType.objects.filter(app_label=app.__name__.split('.')[-2]))
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 84, in __len__
self._result_cache.extend(self._iter)
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 275, in iterator
for row in compiler.results_iter():
File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 335, in results_iter
File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 430, in build_query
File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 160, in add_filters
File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 168, in add_filters
ValueError: need more than 3 values to unpack
I find something related to this error about mongodbengine, a thread on BBS talk about that, but it says this is already fixed.
Simply use the official installation instructions on https://django-mongodb-engine.readthedocs.org/en/latest/topics/setup.html