#17042 closed New feature (fixed)
allow startproject, startapp to write into existing directory or a specified directory
| Reported by: | Preston Holmes | Owned by: | Jannis Leidel |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | yes |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
There might be various times you would want to "convert" an existing directory into a django project/app
such might be the case for when you want to put a project under normal SVN flow of svnadmin create
but there could be a number of circumstances - especially once #15372 is fixed where you want to turn an existing dir into a project container.
Change History (13)
comment:1 by , 14 years ago
| Has patch: | set |
|---|
comment:2 by , 14 years ago
| Summary: | allow startproject, startapp to write into existing directory → allow startproject, startapp to write into existing directory or a specified directory |
|---|
comment:3 by , 14 years ago
I've expanded the scope of this ticket to not only cover the case of an existing directory of the specified name, but to allow a second argument to specify a different existing directory, or the current working directory
comment:4 by , 14 years ago
| Needs documentation: | set |
|---|---|
| Patch needs improvement: | set |
comment:5 by , 14 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
See http://groups.google.com/group/django-developers/browse_thread/thread/44b70a37ff73298b where this idea was debated.
comment:6 by , 14 years ago
| Triage Stage: | Design decision needed → Accepted |
|---|
I don't think there's any reason not to do this, at least based on the discussion in that thread. It's clear that a number of people want the ability to run startproject in an already-existing directory and have it populate that directory rather than create a new one; this would give them that.
comment:7 by , 14 years ago
| Owner: | changed from to |
|---|
comment:8 by , 14 years ago
I've worked on this: https://github.com/jezdez/django/compare/feature/project-app-templates
- Added ability to pass the project or app directory path as the second argument
- Added
--templateoption for specifying custom Python packages containing project and app templates - Cleaned up tests a little while I was there
comment:9 by , 14 years ago
Oh, also, this switches the rendering of the project/app templates to using Django's template engine, as it seemed sensible with regard to extended templates.
By default it uses the optparse option dict as the context for the templates (next to name, directory of new project/app), so it should be easily enough to implement custom startproject/startapp commands for whatever use case by simply adding optparse options.
comment:10 by , 14 years ago
This is a really awesome feature and I can see a lot of power users wanting to use startapp/startproject now, not just newbies.
I only had a couple of minor remarks:
- The 'versionadded' directive is missing for
--template.
- Could/should the doc be extended instead of "see the
source_ for more details"? :-)
- It'd be good to clarify in the doc that
--templateis particularly useful for providing a *custom* layout for your project and app. This is currently only explicitly said in the release notes.
- Also, maybe it's just me but when I first looked at the patch I was a little confused about what
--templatewas for. I'm more used to hearing about a project's or app's *layout*. Maybe it would be clearer if the option was called--layoutinstead? This is not a big deal though.
comment:11 by , 14 years ago
On a second thought, since django.conf is already using the 'app_template' and 'project_template' terminology, then its' probably to just keep the same (ie --template as you've done).
This relies someone on the files "manage.py" and "models.py" being "special markers" - but they are as good as any. manage.py may one day go away, in which case settings could be checked.
https://github.com/django/django/pull/65