Skip to content

Instantly share code, notes, and snippets.

@risha700
Created September 7, 2019 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save risha700/43b942b2096bc0a88e23a2789d91615f to your computer and use it in GitHub Desktop.
Save risha700/43b942b2096bc0a88e23a2789d91615f to your computer and use it in GitHub Desktop.
Ubuntu server pre config

install packages

sudo apt update
sudo apt install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx curl

setup postgres

sudo -u postgres psql
CREATE DATABASE $projectname;
CREATE USER $user WITH PASSWORD 'password';
ALTER ROLE myprojectuser SET client_encoding TO 'utf8';
ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed';
ALTER ROLE myprojectuser SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE $project TO $user;

venv setup

sudo -H pip3 install --upgrade pip
sudo -H pip3 install virtualenv
mkdir ~/myprojectdir
cd ~/myprojectdir
virtualenv myprojectenv

Django and gunicorn

pip install django gunicorn psycopg2-binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment