我如何在 ubuntu 上的 apache 网络服务器上运行 Django 和 phpmyadmin [英] How do i run Django and phpmyadmin on apache webserver on ubuntu
问题描述
我如何在 apache 网络服务器上运行 Django 和 phpmyadmin.我使用了 localhost/phpmyadmin 并且它起作用了,但是在我在 localhost/admin 上配置了 Django 之后,phpmyadmin 不起作用,我从 Django 收到一个错误页面,说 URL 不在 urls.py 中.有没有办法在端口 81(httpd.conf) 上运行 Django,这样它就不会与 phpmyadmin 发生冲突,或者我还缺少其他什么东西.我使用 mod_python 模块.这是我更改位置时的 httpd.conf 文件"/" 到位置 "/home/projects/" Phpmyadmin 工作但 Django 失败,反之亦然
How do i run Django and phpmyadmin on apache webserver. I used localhost/phpmyadmin and it worked but after i configured Django on localhost/admin, phpmyadmin is not working i get an error page from Django saying the URL is not in urls.py. is there a way to run Django on port 81(httpd.conf) so that it will not conflict with phpmyadmin, or is there something else i am missing.I use mod_python module.This is my httpd.conf file when i change the location "/" to location "/home/projects/" Phpmyadmin works but Django fails and viceversa
<location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE hana.settings
PythonPath "['/home/projects/', '/home/projects/mysite', '/home/projects/mysite/mysite'] + sys.path"
</location>
<location "/admin-media">
SetHandler None
</location>
推荐答案
您可以在同一个端口上运行它们.只需在 WSGIAlias
指令之后将这些行添加到您的 apache 配置中:
You can run them both on same port. Just add these lines to your apache config after WSGIAlias
directive:
Alias /phphmyadmin /sys/path/to/phpmyadmin
<Location /phphmyadmin>
SetHandler None
</Location>
您也可以在不同的端口上运行它们.
You can also run them on different ports.
Listen 80
Listen 81
NameVirtualHost *:80
NameVirtualHost *:81
<VirtualHost *:81>
django-config
</VirtualHost>
<VirtualHost *:80>
phph-my-admin-configs
</VirtualHost>
这篇关于我如何在 ubuntu 上的 apache 网络服务器上运行 Django 和 phpmyadmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!