How do i run Django and phpmyadmin on apache webse

2019-06-14 02:36发布

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>

1条回答
小情绪 Triste *
2楼-- · 2019-06-14 03:16

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>
查看更多
登录 后发表回答