Write to yourself, linux Operations and Maintenance Road.
linux:centos7.3+apache+python3.4+django+mod_wsgi+samba
windows: eclipse pycharm sublime
Recently, I have been learning python. Although it is convenient to develop under windows, in general, I will put the program into linux environment to run in summer. so... directly build a linux+windows development environment
----------------------
Python 3.4 installation
# Install epel source first (aliyun)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# yum installation Python 3.4
yum install python34
#pip3 installation
wget https://bootstrap.pypa.io/get-pip.py python3 get-pip.py
Note: python 3 will be used to run commands in the future. The default python command runs version 2.7.5.
------------------------
# apache installation
yum install httpd
# django installation
pip3 install django
65
When I tested the application of Mezzanine CMS, I found out that this problem had been solved for a long time.
vim /etc/sysconfig/httpd
LANG='en_US.UTF-8'
--------------------------------
# mod_wsgi module installation
# Install the compiler Library
yum groupinstall "Development Tools" -y
# Installation Development Package
yum install httpd-devel python34-devel -y
# Install mod_wsgi
pip3 install mod_wsgi
----------------------------------
#samba installation
yum install samba
------------------------------------------
------------------------------------------
All the required software has been installed. Next, configure all the related software.
#httpd configuration
I can tell you that you don't need to set up or start the httpd service.
-------------------------------------
#samba configuration
We chose a directory to share and store program development.
mkdir /share chmod 777 /share
vim /etc/samba/smb.conf
[global] workgroup = WORKGROUP #Same as windows default group security = user [share] path = /share public = yes writeable = yes
Adding users, existing users in linux, I use root users directly for convenience.
smbpasswd -a root
# Start the samba service and set it to self-startup
systemctl start smb systemctl enable smb
#windows
Direct in win+r, open and run, enter \ linux server ip address, enter the corresponding samba username and password just set,
Conveniently, you can map network drives to local locations.
-----------------------------------------------
# django configuration
# Create a new project, and we go into the samba shared directory to create it
cd /share diango-admin startproject blog
# Configure settings.py
vim blog/settings.py
ALLOWED_HOSTS = ['*'] #The host name, IP, which allows django to run, is set directly here *, all INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mod_wsgi.server', #The key is to add oh, mod_wsgi to boot. ]
----------------------------------------
# Last step, run
# command line running, - reload-on-changes automatically refresh, test code at any time, command line last, can run with & background
cd /share/blog #Switch to project directory python3 manage.py runmodwsgi --reload-on-changes --user=apache --group=apache --port=80
Front-end running, direct ctrl+c exit, & background running, exit program with pkill
pkill httpd
Open the browser, can it run directly?
-----------------------------------------
Windows Eclipse can modify files, or use sublime, anyway, share directories, map to local, and toss around.
Reference website: https://pypi.python.org/pypi/mod_wsgi