Install and set up django1.10.3 and Apache2.4 in windows 10, django1.10apache

Source: Internet
Author: User

Install and set up django1.10.3 and Apache2.4 in windows 10, django1.10apache

Environment Introduction

  • Python3.5.2 64-bit
  • Django 1.10.3
  • Apache 2.4 64-bit
  • Windows 10

Focus on apache.

Python and django are believed to be interested in reading this article.

Install Apache2.4

Address: http://www.apachelounge.com/download/

Download: vc_redist.x64.exe to directly install vc_redist_x64/86.exe.

Download: httpd-2.4.17-win64-VC14.zip

Add D: \ Apache24 \ bin to the environment variable path;

Decompress the package to the specified directory to modify the configuration file: http. conf (Change ServerRoot in the following content to your own actual Apche decompression path)

ServerRoot "D:/Apache24 "...... Listen 127.0.0.1: 8081 # modify the port number ...... ServerName www.example.com: 8081 ...... DocumentRoot "D:/Apache24/htdocs" <Directory "D:/Apache24/htdocs"> ...... ScriptAlias/cgi-bin/"D:/Apache24/cgi-bin /"...... <Directory "D:/Apache24/cgi-bin"> AllowOverride None Options None Require all granted </Directory>

Start the apache service:

Cmd> httpd

Http: // MAID: 8081/index.html

It works! Apache configuration successful

Install mod_wsgi

First install:pip install wheel

Installmod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

Download:mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

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

Pip installation:pip install mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl

Configure Apache2.4, mod_wsgi, and django Project

1. Copy C: \ Python35 \ mod_wsgi.so to D: \ Apache24 \ modules.

(Mod_wsgi.so onlymod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whlCan be found only after installation is successful)

2. Modify the http. conf file of apache2.4:

# Add mod_wsgi.so module LoadModule wsgi_module modules/mod_wsgi.so

3. Configure the django project to modify http. conf

# Add mod_wsgi.so module LoadModule wsgi_module modules/mod_wsgi.so # specify the static resource path Alias/statics/F:/pydj/newsCollection/toutiao/statics/<Directory F: /pydj/newsCollection/toutiao/statics> Require all granted </Directory> # specify wsgi for the newsCollection project. py configuration file path WSGIScriptAlias/F:/pydj/newsCollection/wsgi. py # specify the project path WSGIPythonPath F:/pydj/newsCollection <Directory F:/pydj/newsCollection> <Files wsgi. py> Require all granted </Files> </Directory>


Wsgi. py content:

import osos.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings")from django.core.wsgi import get_wsgi_applicationapplication = get_wsgi_application()


# Note that the above myweb is changed to your project name, such as newsCollection. Refer to the directory structure on.

Configure the django project setting. py

ALLOWED_HOSTS = ['127.0.0.1', 'localhost']

Finally tell a little Apche startup error will log, httpd-2.4.23-x64-vc14-r3 \ Apache24 \ logs directory error information, slowly troubleshooting

Summary

The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message, thank you for your support.

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.