0

When creating a project in Django, I get this structure:

mysite/
    manage.py
    mysite/
        __init__.py
        settings.py
        urls.py
        wsgi.py

Is it correct to add view.py, forms.py, models.py, etc., inside the inner directory mysite? I have seen they use it as default but they create a new app for that which already contains some extra files.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Ruben
  • 1,065
  • 5
  • 18
  • 44
  • 2
    What do you mean *"correct"*? It will *work*, but it's unconventional; why don't you want to create an app? – jonrsharpe Jul 01 '15 at 12:18
  • @jonrsharpe I know it will work, "correct" in the way if it is the best practice to do. Why is it unconventional in that way? – Ruben Jul 01 '15 at 12:19
  • 2
    It is a convention from Django's news blogs origin. The default folder is where all the urls get routed. The other apps would be different news websites with a single backend. – TheGeorgeous Jul 01 '15 at 12:20
  • 1
    Anyone who works with your code in the future will be expecting things to be in their own app. It makes things more modular. – kylieCatt Jul 01 '15 at 12:21
  • 2
    See e.g. https://docs.djangoproject.com/en/1.8/intro/reusable-apps/ – jonrsharpe Jul 01 '15 at 12:21

0 Answers0