Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>This project structure is for Django 1.4, though the concepts remain the same</em></p> <p>You can do all of that, just not with a single process. Create a single virtualenv for your project, which can store a shared set of every lib you need. Then create different settings files for each site, which each load different django apps, all located within the project:</p> <pre><code>djangoProject |- bin/ |- include/ |- lib/ |- manage.py |- djangoProject/ |- settings_site1.py |- settings_site2.py |- settings_site3.py |- wsgi_site1.py |- wsgi_site2.py |- wsgi_site3.py |- site1_app/ |- models.py |- views.py |- urls.py |- site2_app/ |- models.py |- views.py |- urls.py |- site3_app/ |- models.py |- views.py |- urls.py </code></pre> <p><strong>settings_site1.py</strong> (example)</p> <pre><code>... # or you could make multiple urls_siteX.py files in the root ROOT_URLCONF = 'djangoProject.site1_app.urls' ... INSTALLED_APPS = ( ... 'djangoProject.site1_app' ) </code></pre> <p><strong>wsgi_site1.py</strong> (example)</p> <pre><code>... os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoProject.settings_site") ... </code></pre> <p>But to be perfectly honest... all of this is even much more easily accomplished if you just create a single virtualenv with multiple django projects. Then you don't have to much with segregating your apps:</p> <pre><code>projectEnv |- bin/ |- include/ |- lib/ |- project1/ |- manage.py |- project1/ |- project2/ |- manage.py |- project2/ |- project3/ |- manage.py |- project3/ </code></pre> <p>Either way you do it, I don't think it is necessary to think about trying to get them all to run under the same single process. Django isn't designed to do that. It is designed to let you run multiple processes on the same project, for different sites, via the sites framework. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload