简体   繁体   English

使用WSGI为Django应用编写正确的Apache虚拟主机脚本

[英]Writing a proper Apache virtual host script, for a Django app using WSGI

I have here a virtual host script for a Django app that I'll eventually deploy into the real world. 我这里有一个Django应用程序的虚拟主机脚本,最终将其部署到现实世界中。 Right now it seems to be working fine; 现在看来,它运行良好。 however, I'd like to know if there's anything wrong with this script, or things that should be improved. 但是,我想知道此脚本是否有任何问题,或者应该改进的地方。

Things to note : 注意事项:

  • The wsgi.py file is simply the one that Django automatically produces. wsgi.py文件只是Django自动生成的文件。 It's in the same directory as the app's source code. 它与应用程序的源代码位于同一目录中。
  • The static files will be served by Apache from the /srv/www/foobar/static/ directory 静态文件将由Apache从/srv/www/foobar/static/目录提供

     <VirtualHost *:80> ServerName foobar.com ServerAlias www.foobar.com ServerAdmin contact@foobar.com WSGIDaemonProcess foobar.com processes=2 threads=20 inactivity-timeout=600 maximum-requests=10000 WSGIProcessGroup foobar.com WSGIScriptAlias / /home/some_user/foobar_django_app/foobar/wsgi.py DocumentRoot "/srv/www/foobar/" Alias "/static/" "/srv/www/foobar/static/" </VirtualHost> 

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

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