Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#20254 closed Uncategorized (needsinfo)

startproject command - need better error message

Reported by: dhivya23 Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: bmispelon@…, dhivya23, t.l.krajca@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

can startproject command throw a more useful error message ?
When I already have started a project called 'companyweb' and have set env variable, DJANGO_SETTINGS_MODULE to its settings file, and I do,

django-admin.py startproject mysite

Unknown command: 'startproject'
Type 'django-admin.py help' for usage

Can this message say something like,
"Unknown command: 'startproject'. Project 'companyweb' is the current project. "

Change History (6)

comment:1 Changed 23 months ago by bmispelon

  • Cc bmispelon@… added
  • Component changed from Uncategorized to Core (Management commands)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

Hi,

Could you provide some mode details on how to reproduce this?

The starproject command should normally always be available regardless of which settings you're using.

I've tried both with django-admin.py and manage.py to create a new project inside an existing one (with the DJANGO_SETTINGS_MODULE env var set), but it succeeded each time.

I'm closing this as needsinfo. Please reopen if you have more information on how to reproduce this issue.

Thanks.

comment:2 Changed 23 months ago by tomask

Hi,

I think this has been fixed in commit a9a0f0b03f9a02deb03617bf7e9773a307d1328f (django 1.4). The 'startproject' and 'startapp' commands are not disabled any more when specifying a settings module.

$ git diff 20c8aa2a2029be50449b25122f85bbef0f2b957f a9a0f0b03f9a02deb03617bf7e9773a307d1328f django/core/management/__init__.py
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 7e8eebd..3672639 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -77,9 +77,7 @@ def get_commands():
     in that package are registered.
 
     Core commands are always included. If a settings module has been
-    specified, user-defined commands will also be included, the
-    startproject command will be disabled, and the startapp command
-    will be modified to use the directory in which the settings module appears.
+    specified, user-defined commands will also be included.
 
     The dictionary is in the format {command_name: app_name}. Key-value
     pairs from this dictionary can then be used in calls to

I hope this helps.

Last edited 23 months ago by tomask (previous) (diff)

comment:3 Changed 23 months ago by dhivya23

Hi,

Thanks for looking into this. I am using django version 1.3.1 . I was following this particular versions documentation, https://docs.djangoproject.com/en/1.3/intro/tutorial01/

If it is fixed in 1.4, can the 1.3 documentation have a note about the DJANGO_SETTINGS_MODULE env variable ? I can submit a documentation change patch for this.

Thanks

comment:4 Changed 23 months ago by dhivya23

  • Cc dhivya23 added
  • Version changed from 1.4 to 1.3

comment:5 Changed 23 months ago by tomask

Hi,

The DJANGO_SETTINGS_MODULE env variable in relation to startproject is mentioned in https://docs.djangoproject.com/en/1.3/ref/django-admin/#django-admin-startproject (for 1.3, 1.2, 1.1 and also 1.0).

This issue has also been discussed and fixed to the satisfaction of the core team before - https://code.djangoproject.com/query?summary=~startproject&col=id&col=summary&col=status&col=owner&col=type&col=component&order=priority, https://code.djangoproject.com/ticket/8639 or https://github.com/django/django/commit/d73c9a5671

comment:6 Changed 23 months ago by tomask

  • Cc t.l.krajca@… added
Note: See TracTickets for help on using tickets.
Back to Top