CENTOS+APACHE+PYTHON34+DJANGO+MOD_WSGI Development Environment Construction

Source: Internet
Author: User
Tags install django pkill aliyun

Write to yourself, Linux OPS. Go through it.

Linux:Centos7.3+apache+python3.4+django+mod_wsgi+samba
windows: Eclipse Pycharm Sublime


Python has been learning recently, although it is easier to develop under Windows, but in general, the program will eventually be put into the Linux environment to run the summer. So ... Build a linux+windows development environment directly

----------------------

python3.4 Installation

#先安装epel源 (Aliyun)

Wget-o/etc/yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-7.repo

#yum安装python3.4

Yum Install Python34

#pip3安装

wget Https://bootstrap.pypa.io/get-pip.pypython3 get-pip.py

Note: Use Python3 to run the command later, the default Python command is 2.7. Version 5

------------------------

#apache安装

Yum Install httpd

#django安装

PIP3 Install Django

#解决apche Django Unicodeencodeerror garbled problem, even the official website did not write, only wrote the method for Ubuntu.

I was testing mezzanine CMS application, found this problem, find n long ah to solve.

Vim/etc/sysconfig/httpd
Lang= ' en_US. UTF-8 '

--------------------------------

#mod_wsgi模块安装

#安装编译库

Yum Groupinstall "Development Tools"-y

#安装开发包

Yum Install Httpd-devel python34-devel-y

#安装mod_wsgi

PIP3 Install Mod_wsgi

----------------------------------

#samba安装

Yum Install Samba

------------------------------------------

------------------------------------------

All required software is installed, below, to configure all relevant

#httpd配置

I can tell you that you do not need to set up or start the httpd service.

-------------------------------------

#samba配置

We choose a directory to share, and store the program development

Mkdir/sharechmod 777/share
Vim/etc/samba/smb.conf
[Global]workgroup = Workgroup #跟windows默认组一样security = User[share]path =/sharepublic = Yeswriteable = yes

#添加用户, Linux already exists in the user, I for convenience, directly with the root user.

Smbpasswd-a Root

#启动samba服务, and set as self-booting

Systemctl start Smbsystemctl Enable SMB

#windows

Directly in the Win+r, open the Run, enter the \\linux server IP address, enter the Samba username and password corresponding to the settings you just set,

If it is convenient, you can map the network drive to local.

-----------------------------------------------

#django配置

#新建一个项目, we go into the Samba shared directory to create

Cd/sharediango-admin Startproject Blog

#配置settings. py

Vim blog/settings.py
allowed_hosts = [' * '] #允许运行django的主机名, IP, directly set here *, all Installed_apps = [' django.contrib.admin ', ' Django.contrib.auth ', ' Django.contrib.contenttypes ', ' django.contrib.sessions ', ' django.contrib.messages ', ' Django.contrib.stati Cfiles ', ' mod_wsgi.server ', #关键, to add Oh, mod_wsgi to start, to use. ]

----------------------------------------

#最后一步, run

#命令行运行,--reload-on-changes Auto Refresh, test code at any time, command line Finally, can be run with & background

Cd/share/blog #切换到项目目录下python3 manage.py runmodwsgi--reload-on-changes--user=apache--group=apache--port=80

Foreground run, direct CTRL + C exit, & background run, exit program with Pkill

Pkill httpd


Open the browser, is it possible to run directly?

650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M00/96/2B/wKiom1kdf2rCO6aiAABT6ep-SMQ355.jpg "title=" 3.jpg "alt=" Wkiom1kdf2rco6aiaabt6ep-smq355.jpg "/>

-----------------------------------------

Windows eclipse modifies files, or can be used sublime, anyway share directory, map to local, casually toss


650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M01/96/2A/wKioL1kdcSbBlZkrAADp5zYKJpg541.jpg "title=" 3.jpg "alt=" Wkiol1kdcsbblzkraadp5zykjpg541.jpg "/>


Reference URL: Https://pypi.python.org/pypi/mod_wsgi

This article comes from the "Endless Struggle for Life" blog, please be sure to keep this source http://shenfly231.blog.51cto.com/12811004/1927275

CENTOS+APACHE+PYTHON34+DJANGO+MOD_WSGI Development Environment Construction

Related Article

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.