Apache2.4 Deploying python3.6+django2.0 Projects

Source: Internet
Author: User

First, install Apache

Apache is a very famous Web server software, if you want to make our web project run almost without it.

Apache Official website: http://httpd.apache.org/

Depending on your environment, select the appropriate version to download. Apache website does not have a Windows 64-bit version, can be downloaded by the following link: Win7 64-bit: http://www.apachelounge.com/download/win64/

Download installation complete, Apahche directory structure is as follows:

To modify the conf/httpd.conf file:

"D:/pydj/apache24"127.0.0.1:8089    #修改端口号 ... ServerName localhost:8089    "D:/pydj/apache24/htdocs" <directory "D:/pydj/apache24/htdocs" >  /cgi-bin/"d:/pydj/apache24/cgi-bin/" ... <directory "D:/pydj/apache24/cgi-bin" >    allowoverride none    Options None    Require all granted </Directory> ...

The main is the path and the change of port number, if you start the Apache Httpd.exe program when the Flash is gone, please check these configuration.

Start the Bin/httpd.exe program

Access via browser: http://127.0.0.1:8089/

It can now be explained that Apache work is normal.

Second, installation Mod_wsgi

MOD_WSGI Website: http://code.google.com/p/modwsgi/

: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi

1. The corresponding version of Win7 64-bit, Python 3.6.4, Apache (httpd-2.4.33) is: MOD_WSGI-4.6.4+AP24VC14-CP36-CP36M-WIN_AMD64.WHL

I. The Apache version of this plugin corresponds to the 14 VC is

II. Python version is 3.6

Iii. 64-bit system

Select the appropriate version when downloading, or Apache will start with a problem

2. After download, the suffix is changed to. zip for decompression, but cannot find the mod_wsgi.so file after decompression

3. Copy the downloaded. WHL file to the python\scripts and enter the cmd command in that directory to execute

PIP3 Install "MOD_WSGI-4.6.4+AP24VC14-CP36-CP36M-WIN_AMD64.WHL"

4. Install to run under the \scripts folder of the Python installation directory after successful installation

5. Output the following three rows of results, copy the three rows to the http.cnf file for configuration

LoadFile "C:/python36/python36.dll""C:/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_ Amd64.pyd "" C:/python36 "

In place of other tutorials

LoadModule Wsgi_module modules/mod_wsgi.so  

Iii. configuring Apache and Django Projects

Highlight My directory:

Apache Storage directory: D:\pydj\Apache24

Django Project directory: D:\pydj\mysite

Open the Apache configuration file httpd.conf again:

"C:/python36/python36.dll" "C:/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"  "c:/python36"/d:/pydj/mysite/mysite/wsgi.py# Specify the project path Wsgipythonpath D:/pydj/MySite <directory d:/pydj/mysite/mysite><files wsgi.py>    Require all granted</Files> </Directory>

The above path, please modify according to your actual situation.

Open a settings.py file to add:

= [' 127.0.0.1 ', ' localhost ']

Start the Apache24/bin/httpd.exe program again

Access via browser: http://127.0.0.1:8000/blog/

Description of Project Deployment success!

Apache2.4 Deploying python3.6+django2.0 Projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.