-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopo_setup_instructions.txt
55 lines (44 loc) · 1.71 KB
/
copo_setup_instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# update and upgrade ubuntu
sudo apt-get update
sudo apt-get upgrade
# create virtual environment
sudo apt-get install python-virtualenv
sudo virtualenv --python=python3 <env_name>
# activate virtual machine and install python deps and deactivate
pip install -r requirements.txt
deactivatesudo su - postgres
# install postgresql
sudo apt-get install libpq-dev python-dev
sudo apt-get install postgresql postgresql-contrib
# create user and db on postgres
sudo su - postgres
createdb <dbname>
createuser -P <username>
psql
GRANT ALL PRIVILEGES ON DATABASE <dbname> TO <username>;
# install nginx and gunicorn
sudo apt-get install nginx
source activate
pip install gunicorn
# setup django test project if necesary
django-admin.py startproject myproject]
# install django postgres plugin
pip install psycopg2
# add this to the project settings
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'copo', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'fshaw',
'PASSWORD': 'Apple123',
'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
# migrate
python manage.py migrate
# start gunicorn, -b sets the host/port, workers should be set to num_cores * 2 + 1
gunicorn --workers=5 -b 127.0.0.1:8080 test_django_project.wsgi:application
# install and start nginx
sudo apt-get install nginx
sudo service nginx start
# see accompanying settings files for configuring gunicorn and nginx