简体   繁体   English

使用mod_wsgi部署Django(python)项目

[英]Deploying django(python) project with mod_wsgi

I am new to django and mod_wsgi, when I was trying to deploy a django project(in python) demo on Apache using mod_wsgi, I encountered some problem as following: 我是django和mod_wsgi的新手,当我尝试使用mod_wsgi在Apache上部署django项目(在python中)演示时,遇到了以下问题:

When the demo runs on django's built-in webserver with command 'python manage.py runserver', everything looks normal like Running on built-in server 当演示使用命令'python manage.py runserver'在django的内置Web服务器上运行时 ,一切看起来都很正常,就像在内置服务器上运行

while when running on Apache/mod_wsgi with command 'mod_wsgi-express start-server wsgi.py' , it looks like this: Running on Apache/mod-wsgi 当使用命令'mod_wsgi-express start-server wsgi.py'在Apache / mod_wsgi上运行时,它看起来像这样: 在Apache / mod-wsgi上运行

I have no idea which part of my code or configuration goes wrong, could anyone help me out? 我不知道我的代码或配置的哪一部分出错了,有人可以帮我吗?

This is because runserver serves css files for you. 这是因为runserver为您提供css文件。 But in production you need to set up Apache to serve your static folder. 但是在生产中,您需要设置Apache来提供您的静态文件夹。 Add alias to your apache config, eg 将别名添加到您的apache配置中,例如

Alias /static /path/to/static_folder

Read more on managing static files . 阅读有关管理静态文件的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM