Hi all!
Started with Django a few days ago (version 2.0, Python 3.6.3). As a noob (no experience with Python and Django, and very little with MVC (sorry, MTV ;-) ), I have a little question that wasn't really clear to me from the tutorial.
When creating a project, for example 'my_first_django' and creating the polls app, my directory structure would be:
my_first_django
\_ my_first_django
\_ polls
Those 2 (\_ my_first_django and \_ polls) are both apps, right? my_first_django being the 'main' app, with the projects' settings.py. I didn't really get that from the tutorial.
My confusion comes from the fact that I want to create a site project and it feels more logical to start with the 'main' app and build modules (apps) next to it. The tutorial doesn't start there.
What is the common practice? Don't use the 'main' app ( my_first_djano in this case ) as an app at all, only just for some global settings, or use it as the main app and create other apps as 'modules' that can be used from within the main? Maybe a silly question. Sorry about that.
I am also asking because I want to use template inheritence in the polls app. I got it working by putting a base.html in /my_first_django/my_first_django/templates , in /my_first_django/my_first_django/apps.py I put:
from django.apps import AppConfig
class MainConfig(AppConfig):
name = 'my_first_django'
And set that in the settings.py [INSTALLED_APPS] section ( 'my_first_django.apps.MainConfig', ). (I probably shouldn't have used MainConfig but MyFirstDjangoConfig, right?)
Now I can call the base.html template from the template in the polls app:
{% extends "base.html" %}
Is this the correct way to go about it?
Thanx for any help!
Regards,
Marcel