torchbox / wagtail-template

A Django template for starting new Wagtail projects with Vagrant. NO LONGER MAINTANED
19 stars 8 forks source link

Restructuring ideas #28

Open kaedroho opened 9 years ago

kaedroho commented 9 years ago

In this template, we put all the projects code in a subdirectory. This is a nice way to separate code from configuration. Making the project easier to browse (especially for people who are unfamilar with the project).

Theres a couple of issues though...

I propose that we make two changes:

Make python run in the root directory (instead of the subdirectory)

Move settings/urls/wsgi one level up

Example:

├── docs
│   └── ...
└── vagrant
│   └── ...
├── {{ project_name }}
│   ├── app1
│   │   └── ...
│   ├── app2
│   │   └── ...
│   ├── static
│   │   └── ...
│   ├── templates
│   │   └── ...
│   ├── settings
│   │   ├── base.py
│   │   ├── dev.py
│   │   └── production.py
│   ├── urls.py
│   └── wsgi.py
├── fabfile.py
├── requirements.txt
└── manage.py

The biggest change this would mean for developers is the import paths for their apps would all change. For example, if you wanted to import the model Foo from the app app1, you'd have to do from my_project.app1.models import Foo. I personally dont think this is a bad thing for the following reasons:

balazs-endresz commented 9 years ago

Where would urls.py, wsgi.py and manage.py be in this layout?

kaedroho commented 9 years ago

manage.py would be in the root alongsite fabfile.py, requirements.txt, etc

urls.py and wsgi.py would be in the project folder (/project_name/{urls,wsgi}.py)

kaedroho commented 9 years ago

Just added an example to the above post to hopefully better illustrate the structure...