-
Notifications
You must be signed in to change notification settings - Fork 27
PYTHON-4814 Create project and app templates #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is ready to go in assuming folks think this should go in here. It reduces setup of a new project and app to one extra command to generate migrations for Django apps:
Then:
|
Could you also update the README instructions to reflect these new suggested steps? |
- Update readme
|
||
Then | ||
```console | ||
$ python manage.py makemigrations admin auth contenttypes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we could include the migrations in the project template.
$ python manage.py migrate | ||
``` | ||
|
||
### Manual steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure the readme is structured so that readers don't skip over this section since it contains a lot of useful info that's needed beyond just getting this working. For example, creating migrations and custom app configs for third-party apps they want to use.
To create a new Django project that uses MongoDB, you can use the templates in this repository. For example: | ||
|
||
```console | ||
$ django-admin startproject --template=project_template mysite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should include these templates in this repo. Normally, users will be pip installing this package, which means they would either have to reference --template=/path/to/site-packages/django_mongodb/project_template
or install via a URL. It looks like you modified the source distribution not to include the templates, so it's unclear how you're expecting this command to work. Probably installing via URL makes the most sense, which means we could include them in this repo and exclude them from the source, or a separate repo could work just as well. We should have separate templates for each version of Django, which could just be branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should include these templates in this repo. Normally, users will be pip installing this package, which means they would either have to reference
--template=/path/to/site-packages/django_mongodb/project_template
or install via a URL. It looks like you modified the source distribution not to include the templates, so it's unclear how you're expecting this command to work.
I'm running these local but I'm not sure either … now would be a good time to decide. I think I'm leaning slightly towards closing this PR and creating templates in a separate repository, particularly if we're going to be providing branches for each major Django release.
Probably installing via URL makes the most sense, which means we could include them in this repo and exclude them from the source, or a separate repo could work just as well. We should have separate templates for each version of Django, which could just be branches.
Agree! And the example you provided is nice. What do you think @Jibola ?
DEFAULT_AUTO_FIELD = 'django_mongodb.fields.ObjectIdAutoField' | ||
|
||
MIGRATION_MODULES = { | ||
'admin': '{{ project_name }}.mongo_migrations.admin', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way could be fine, but note this is configured differently than the manual steps where I put mongo_migrations
in a top-level directory.
Moving to separate repo, thanks all 👍 |
fixes #147