Opened 17 years ago
Closed 17 years ago
#6789 closed (fixed)
[patch]django-admin.py warning on usage of python mod name as project name
Reported by: | Garion | Owned by: | Thejaswi Puthraya |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | django-admin.py warn project name | |
Cc: | thejaswi.puthraya@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
First of all, kudos on a very clear and thorough tutorial. The steps are small enough not to skip things, but large enough to get somewhere. I have a small suggestion for improvement though:
Tutorial01 says:
"You’ll need to avoid naming projects after built-in Python or Django components. In particular, this means you should avoid using names like django (which will conflict with Django itself) or site (which conflicts with a built-in Python package)."
I understood this, so I chose the name 'bdb' for my project, which is not a python keyword. This name led to a correct project start, but as soon as I ran ./manage.py runserver
, there was an error about not being able to find bdb.settings. This in turn led me (and #django) to think there was a problem with module paths. It took us about half an hour before we figured out that 'bdb' is an existing python module, and that was the cause of the problems.
So, it would be even better if the above text also said how you can check this: "After you've chosen a name for your project, start the python interactive shell and type 'import projectname'. If this succeeds, the name you've chosen is already in use, and you must choose another name."
Or, alternatively, it would be great if django-admin.py startproject namehere
tried "import namehere", and if that succeeds, tell the user to choose another name.
Attachments (1)
Change History (5)
comment:1 by , 17 years ago
by , 17 years ago
comment:2 by , 17 years ago
Cc: | added |
---|---|
Component: | Uncategorized → django-admin.py |
Has patch: | set |
Keywords: | django-admin.py warn project name added; tutorial removed |
Owner: | changed from | to
Status: | new → assigned |
Summary: | Suggestion for textual improvement tutorial01 → [patch]Suggestion for textual improvement tutorial01 |
Triage Stage: | Unreviewed → Accepted |
Added the patch that first checks if the module can be imported ie is a standard module or a module in the current directory. Next if it was not imported then it checks in the INVALID_PROJECT_NAMES to check if it exists in that list.
comment:3 by , 17 years ago
Summary: | [patch]Suggestion for textual improvement tutorial01 → [patch]django-admin.py warning on usage of python mod name as project name |
---|
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
diff for the ticket #6789