multiple domains - one django project
<p>I want to run ONE django project on multiple domains/websites. The websites each need to access a unique "urls.py"/"views.py". I tried it already with <a href="http://michal.karzynski.pl/blog/2010/10/19/run-multiple-websites-one-django-project/" rel="nofollow">this tutorial</a>, but it doesn't work for me.
Is there a way to do this with middleware in an easy way (without the Sites framework)?
A little bit of help would be really great. Thanks.</p>

<p>Edit: As I tried it like in the tutorial from above, my httpd.conf looked like this:</p>

<pre><code>ServerRoot "/home/webfactionusername/webapps/erdbeer/apache2"

LoadModule authz_core_module modules/mod_authz_core.so
LoadModule dir_module        modules/mod_dir.so
LoadModule env_module        modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module       modules/mod_mime.so
LoadModule rewrite_module    modules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module       modules/mod_wsgi.so
LoadModule unixd_module      modules/mod_unixd.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/webfactionusername/logs/user/access_erdbeer.log combined
ErrorLog /home/webfactionusername/logs/user/error_erdbeer.log

Listen 10414
KeepAlive Off
SetEnvIf X-Forwarded-SSL on HTTPS=1
ServerLimit 1
StartServers 1
MaxRequestWorkers 5
MinSpareThreads 1
MaxSpareThreads 3
ThreadsPerChild 5

WSGIDaemonProcess erdbeer processes=2 threads=12 python-path=/home/webfactionusername/webapps/erdbeer:/home/webfactionusername/webapps/erdbeer/myproject:/home/webfactionusername/webapps/erdbeer/lib/python2.7
WSGIProcessGroup erdbeer
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIScriptAlias / /home/webfactionusername/webapps/erdbeer/myproject/myproject/wsgi.py


# Virtual hosts setup
NameVirtualHost *
&lt;VirtualHost *&gt;
    ServerName mydomain123abc.de

    WSGIDaemonProcess erdbeer processes=5 python-path=/home/webfactionusername/webapps/erdbeer:/home/webfactionusername/webapps/erdbeer/lib/python2.7 threads=1
    WSGIScriptAlias / /home/webfactionusername/webapps/erdbeer/subdomain1.wsgi
&lt;/VirtualHost&gt;

&lt;VirtualHost *&gt;
    ServerName seconddomain123.de

    WSGIDaemonProcess erdbeer processes=5 python-path=/home/webfactionusername/webapps/erdbeer:/home/webfactionusername/webapps/erdbeer/lib/python2.7 threads=1
    WSGIScriptAlias / /home/webfactionusername/webapps/erdbeer/subdomain2.wsgi
&lt;/VirtualHost&gt;
</code></pre>

<p>Edit2: I'm still not able to grasp this middleware-concept. I only was able to understand how that I probably need to use "process_request", but I have no clue how the middleware-file would look like. Lets say I have "domain1.com" and "domain2.com" which should use these urls:</p>

<p>domain1_urls.py</p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin
from django.http import HttpResponse

urlpatterns = [
    url(r'^$', 'myapp1.views.home'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow:", content_type="text/plain")),
]
</code></pre>

<p>domains2_urls.py</p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin
from django.http import HttpResponse

urlpatterns = [
    url(r'^$', 'myapp2.views.home'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow:", content_type="text/plain")),
]
</code></pre>

<p>How would I use that in my middleware? (I'm a beginner...)</p>