Django 1.4 (MEDIA_ROOT, STATIC_ROOT, TEMPLATE_DIRS)

I have a Django 1.3 project with these parameters in settings.py

SITE_ROOT = os.path.dirname (os.path.realpath ( __ file __ ))

STATIC_ROOT = os.path.join (SITE_ROOT, 'static')

MEDIA_ROOT = os.path.join (SITE_ROOT, 'media')

TEMPLATE_DIRS = (os.path.join (SITE_ROOT, 'templates'),)

But in Django 1.4, by default, settings.py moves to a subdirectory with a name that is equal to the name of the project. Because of this, static , media directories and templates should now be moved to the same subdirectory?

Is that what I have to do, or just change the parameters STATIC_ROOT, MEDIA_ROOT and TEMPLATE_DIRS?

I know that both options are fine, but which is better for this in Django 1.4?

And also I know that each application can have its own templates and static directories.

And is it better to place all other application directories inside the same subdirectory? This is not what happens by default using manage.py startapp

+5
source share
1 answer

OK, I follow the following pattern:

myproject/requirements.txt - packages with the ability to install

myproject/deployment - deployment elements, such as server configuration files, instruments (dummy data), etc.

myproject/docs - project docs

myproject/tests - project tests

myproject/myproject - project operation code (and settings.py, urls.py)

Folder extension myproject/myproject:

myproject/myproject/app1 - ( / )

myproject/myproject/app2 - ( , )

myproject/myproject/website - , .

website 4 :

1) models.py ( django )

2) a views.py index. , , .

3) a management dir django commands, .

4) a templates dir, 404.html 505.html. , website, / html, extends, index.html.

5) a static dir css, js media .

, . , , - , .

EDIT: VS VS, settings_local, , .

+7
source

All Articles