nginx, python3, uwsgi, django stack on Arch Linux (Raspberry Pi2)

1. Install necessary packags from repo.
sudo pacman -S python sqlite nginx python-pip python-django

2. Install uwsgi.
sudo pip install uwsgi

3. Set up uwsgi emperor
mkdir /etc/uwsgi
mkdir /etc/uwsgi/vassals

vim /etc/uwsgi/emperor.ini
emperor = /etc/uwsgi/vassals
#uid = http
#gid = http

vim /etc/systemd/system/emperor.uwsgi.service
Description=uWSGI Emperor

ExecStart=/usr/bin/uwsgi –ini /etc/uwsgi/emperor.ini
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -INT $MAINPID


4. Create first site. startproject mysite

5. Place configuration files in the project directory
cd mysite
cp /etc/nginx/uwsgi_params ./

vim mysite_nginx.conf
upstream django {
#server unix:///path/mysite.sock; # for using unix socket

server {
listen 80;
charset utf-8;

location / {
uwsgi_pass django;
include /path/uwsgi_params;

vim /etc/nginx/nginx.conf and add below to http directive
include /etc/nginx/sites-enabled/*;

mkdir /etc/nginx/sites-enabled/
sudo ln -s /path/mysite/mysite_nginx.conf /etc/nginx/sites-enabled/

vim mysite_uwsgi.ini

chdir = /home/users/www/mysite/
module = mysite.wsgi
master = true
processes = 4
socket =

sudo ln -s /path/mysite_uwsgi.ini /etc/uwsgi/vassals/

5. start the services
systemctl start emperor.uwsgi
systemctl start nginx

6. django
cd mypage
python migrate
python createsuperuser


Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: