Django configuration issues - ValueError: Empty module name

I decided to play a little with Django (since I heard so much about it). I go through the tutorial here:

http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01

about the middle of the tutorial, I asked to run it from my command line:

python manage.py syncdb

However, I get this error:

C:\django-projects\mysite>python manage.py syncdb Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager utility.execute() File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 257, in fetch_command klass = load_command_class(app_name, subcommand) File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "C:\Python25\lib\site-packages\django\utils\importlib.py", line 35, in import_module __import__(name) File "C:\Python25\lib\site-packages\django\core\management\commands\syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "C:\Python25\lib\site-packages\django\core\management\sql.py", line 5, in <module> from django.contrib.contenttypes import generic File "C:\Python25\lib\site-packages\django\contrib\contenttypes\generic.py", line 6, in <module> from django.db import connection File "C:\Python25\lib\site-packages\django\db\__init__.py", line 75, in <module> connection = connections[DEFAULT_DB_ALIAS] File "C:\Python25\lib\site-packages\django\db\utils.py", line 91, in __getitem__ backend = load_backend(db['ENGINE']) File "C:\Python25\lib\site-packages\django\db\utils.py", line 32, in load_backend return import_module('.base', backend_name) File "C:\Python25\lib\site-packages\django\utils\importlib.py", line 35, in import_module __import__(name) ValueError: Empty module name 

here is the important part of my setup.py

 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'c:/python25/ramysDB', # 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. } } 
+7
python django installation
source share
3 answers

It appears that your database is not configured correctly. Check the settings.py settings and make sure you have a valid database DBMS:

 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # 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. } } 

Probably you want django.db.backends.sqlite3 ? And set a NAME for him.

Update:

You have an extra period in the ENGINE. Change it to 'django.db.backends.sqlite3'. Hope this helps.

+5
source share

I got this error due to a nonexistent Django application name specified in settings.py parameters, which in our case was an empty string:

 INSTALLED_APPS = ( ... '' ) 

Removing one line solved the problem.

+8
source share

Add the application name to "INSTALLED_APPS" in settings.py

0
source share

All Articles