Hi all,

There's a pattern I like to use in my projects which I'd like to
suggest for django startproject.

It looks like:

project_name/
  setup.py
  src/
    myapp1/
    myapp2/
    project_name/
      settings.py
      urls.py
      manage.py
      wsgi.py

My settings.py here uses environment variables for everything to
override defaults.

Setup.py here allows:

- Adding an entry point,
- Installing all apps as packages,
- Installing test dependencies with extra_requires and pip install
project_name[test],
- Adding runtime dependencies.

For example, with that:

    entry_points = {
        'console_scripts': [
            'project_name = project_name.manage:main',
        ],
    },

And such a manage.py:

  def main():
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

  if __name__ == "__main__":
    main()

Installing the package will add the project_name command, allowing to
run `project_name migrate` for example from any directory.

I know it's too opinionated to add that to django, but I'd like to
open a discussion here and perhaps there's something we might find
worth changing in django's default project template.

Thanks for reading !

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALC3Kacfi68SAA%3DC0AVX%2B3r8dPwOM3cJcBrdiC4CpZEF-NiCCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to