Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12428 closed (fixed)

Projects created with django-admin.py startproject no longer run if no databases have been configured

Reported by: simon Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

(ve)simon $ ./manage.py runserver 0.0.0.0:8003
Validating models...
Unhandled exception in thread started by <function inner_run at 0x1363c30>
Traceback (most recent call last):
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 48, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/core/management/validation.py", line 22, in get_validation_errors
    from django.db import models, connection
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/db/__init__.py", line 74, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/db/utils.py", line 73, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/db/utils.py", line 20, in load_backend
    return import_module('.base', backend_name)
  File "/Users/simon/Development/django_signed_demo/ve/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
ValueError: Empty module name

The problem is that "django-admin.py startproject" creates a new project with the following in the settings file:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.',
         ...

Django then chokes on the invalid ENGINE setting.

Brand new projects should work without needing the database to be manually configured, since some projects don't use a database at all.

Attachments (1)

12428.diff (2.4 KB) - added by simon 5 years ago.
Patch from Alex Gaynor

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by simon

Patch from Alex Gaynor

comment:1 Changed 5 years ago by simon

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

comment:2 Changed 5 years ago by simon

  • Summary changed from Project's created with django-admin.py startproject no longer run if no databases have been configured to Projects created with django-admin.py startproject no longer run if no databases have been configured

comment:3 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [11974]) Fixed #12428: Ensured that the dummy backend is installed correctly on a fresh project generated by django-admin.py startproject. Thanks to Simon for the report.

comment:4 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top