How can Django projects be deployed with minimal installation work?

前端 未结 7 1640
花落未央
花落未央 2021-02-02 04:39

To deploy a site with Python/Django/MySQL I had to do these on the server (RedHat Linux):

  • Install MySQLPython
  • Install ModPython
  • Install Django (u
7条回答
  •  离开以前
    2021-02-02 05:26

    To enable easy Django deployement I would to the following:

    Fisrt-time server configuration

    • Install mod_wsgi which allow you to run in embedded mode OR in daemon mode.
    • Install python and virtualenv

    In your development environment

    • Use virtualenv. Take a look at mod_wsgi and virtualenv configuration
    • Install Django your django version (using python setup.py install)
    • Install your python libs
    • Develop your project

    Every time you want to deploy

    • Copy your virtual environment to the production server
    • Just add an Include directive in your httpd.conf file (or use .htaccess) to your project's apache configuration. As stated in mod_wsgi integration with django documentation, one example of how Apache included file could be configured would be:

    Alias /media/ /usr/local/django/mysite/media/
    
    
      Order deny,allow
      Allow from all
    
    
    WSGIScriptAlias / /usr/local/django/mysite/apache/django.wsgi
    
    
      Order deny,allow
      Allow from all
    
    

    Automating deployement

    • I would consider using Fabric to automate deployement

提交回复
热议问题