Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Win7 installs Apache and deploys the django environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. Overview

Most python developers are in the windows environment, the deployment of the python django mysql environment is a common environment, the installation of mysql,python under windows is basically installation, the next step is not introduced, mainly introduces the configuration of the django apache compatible environment.

System: win7 32max 64

Software environment: python 2.7.x; django 1.8.x, apache 2.2.25

Apache 2.2.25 and django wsgi.so modules can be downloaded here.

II. Apache installation and deployment of the django project

When you download the zip file, you will have the following two files

Httpd-2.2.25-win32-x86-no_ssl.msi # apache installation Files

Mod_wsgi.so # django deployment module

Double-click to run and install apache as shown in the figure:

The above three items can be filled in or not for the time being. Next

Installed by default under C:\ Program Files\ Apache Software Foundation\ Apache2.2

Change to the bin directory under this directory and do the following: as shown in the figure:

Httpd.exe-k stop

Httpd.exe-k start

No error indicates that the installation started successfully. At the same time, the apache service icon will also appear in the lower right corner of the desktop, or it may be started graphically. You can quickly locate errors by starting with the command line. (if there is a mistake).

Configure apache to deploy the django project

1. Confirm the djanog version

2. Perform the conf directory under the apache installation directory

Back up httpd.conf before configuration

Open httpd.conf with sublime or another editor and add the following at the end:

WSGIScriptAlias / C:/PythonCMDB/PythonCMDB/wsgi.py # django project wsgi.py location WSGIPythonPath C:/PythonCMDB # django project location WSGIPythonHome C:/Python27 # python home directory # set Order allow,deny Allow from all Require all granted Satisfy AnyAlias / static C:/PythonCMDB/static # static file (html) permissions for django project permissions Order allow Deny Allow from all

3. Installation and configuration of wsgi.so module

Copy the extracted wsgi.so file to C:\ Program Files\ Apache Software Foundation\ Apache2.2\ modules

Configuring httpd.conf is about 61 lines.

Add as follows

LoadModule wsgi_module modules/mod_wsgi.so

4. Restart apache

If there is no error, there is no problem.

IV. Validate deployment

Open the browser and enter http://127.0.0.1/index (the access to the django project under pycharm may be http://127.0.0.1:8000/index) as shown in the figure:

This is done in combination with the deployment of the python2.7.13 djaingo1.82 apache2.2.25 environment.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report