Is mod_WSGI replacing what apache is doing and how I can make wsgi work at a specific path only

时间:2017-08-05 10:50:16

标签: python linux django apache mod-wsgi

I am quite new to Apache and WSGI, there are a lot of things confusing me.

After a fresh install of apache2 on ubuntu, I can open this URL to see the default apache page http://localhost/index.html, the file is residing in /var/www/html. So this is the function that apache server provices, serving http connection.

Here's the current situation:

I've created a simple Django project and install mod_wsgi onto my apache server,and finally I managed to deploy the project to apache and the page iIve created can be accessed correctly.

BUT now when I try to access the index.html i mentioned above, it shows the url mapping cannot be found(yes I do not have this mapping in the django project).Is Django taking over all the path that point to the server?

How can I make the django project only map to a specific path like http://localhost/Django/[MY URL MAPPING] and keep other url mapping untouched.

So I can access the static HTML(index.html) by accessing http://localhost/index.html/ and access my Django project by accessing http:/localhost/Django/[xxx]

Is this possible? or I have to use another virtual host at another port? Any help will be much appreciated.

1 个答案:

答案 0 :(得分:1)

You can do this by mounting Django at a different point:

WSGIScriptAlias /Django /path/to/mysite.com/mysite/wsgi.py

This runs the WSGI application at /Django, and leaves Apache to serve the rest of the files directly.