Django: Create a Django project with Pycharm and publish it to apache2.4

Source: Internet
Author: User

    • Environment:

python2.7 x64

Win7 x64

Django (automatically installed with Pycharm) version: 1.10.2

apache:2.4 x64

    • Download Pycharm Personal Edition non-community version and activate

Initially, a Community edition was downloaded, and it was found that there was no integration of Django at all. Later checked, in the Community version Pycharm can also be developed (see note 1:)

Note 1: The following steps are required to develop Django under Community Edition Pycharm:

1, self-installation Django;

2, use Django under CMD to create the project;

3, after the use of Pycharm open project to develop.

And also found the latest personal version Pycharm can find the activation code, so download the personal version, and successfully activated.

Reference: http://www.360kb.com/kb/2_24.html

    • Create a project using Pycharm and test:

1. Create the project

2, modify the view.py

3, modify the urls.py

4. Running and commissioning

Access in the browser:

    • Install Apache:

1, the official website download:

http://www.apachehaus.com/cgi-bin/download.plx#APACHE24VC09

Download version:

2. Download mod_wsgi.so

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

Download file:

3. Configure and install apache2.4

3.1, the 1, downloaded Apache extracted to the D disk: D:\Program Files\apache24

3.2, the 2, download the file decompression, and the extracted mod_wsgi.so copy to D:\Program Files\apache24\modules under;

3.3. Modify D:\Program files\apache24\conf\httpd.conf file:

#Modify the default port 80 8082Listen 8082#Add mod_wsgi.so moduleLoadModule Wsgi_module modules/mod_wsgi.so#Specify the wsgi.py configuration file path for the MyWeb projectwsgiscriptalias/d:/untitled/untitled/wsgi.py#Specify Project PathWsgipythonpath d:/Untitled#Modify the servername port to 8082ServerName localhost:8082#<directory/>#allowoverride None#Require all denied#</Directory><directory d:/untitled/untitled><files wsgi.py>Require All granted </files></directory>Alias/static d:/untitled/untitled/static<directory D:/untitled/untitled/static>allowoverride None Options none Require all granted </directory>

3.4. Register apache2.4 to Windows services:

CMD under install command:

Note:

1, the top of the installation command means "D:\Program Files\apache24\bin\httpd.exe", registered as a Windows service, the name of the service Apache.

2. Top Apache Service Uninstall command: D:\Program files\apache24\bin\ under execution:

SC Delete Apache

3, if the installation success will prompt the relevant information, if prompted port 443 port failure, you need to modify the configuration file: D:\Program files\apache24\conf\extra\httpd-ahssl.conf and D:\Program files\ The 443 port in the apache24\conf\extra\httpd-ssl.conf is a different port (for example: 442).

4, debugging whether Apache under normal operation:

Input URL: http://127.0.0.1:8082/MyTest/hello/

Return to normal result:

    • Resources:

http://blog.csdn.net/chun8416/article/details/43149317 (Apache 443 port is occupied workaround)

http://jingyan.baidu.com/article/d8072ac47baf0eec95cefdca.html (Apache server latest version download, install and configure (win version))

http://blog.csdn.net/yingmutongxue/article/details/43985559 (django1.7+apache2.4 Deployment)

Django: Create a Django project with Pycharm and publish it to apache2.4

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.