Skip to content

Instantly share code, notes, and snippets.

@ademidun
Last active September 26, 2020 19:08
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 ademidun/f79db581212a9c680e914c0fc89a77c4 to your computer and use it in GitHub Desktop.
Save ademidun/f79db581212a9c680e914c0fc89a77c4 to your computer and use it in GitHub Desktop.
Set up Django on Cloud 9 or Fedora

python-3.6.2

  1. Set up Github ssh

ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

  1. Config your github credentials:
git config --global user.email "email@example.com"
git config --global user.name
  1. Clone

  2. Install Postgresql 9.6 (because it has JSONb support which is need for out JsonField) Follow this tutorial but replace postgresql with postgresql96.

Linux (cloud 9)

sudo yum install postgresql96 postgresql96-server postgresql96-devel postgresql96-contrib postgresql96-docs -y;

sudo service postgresql96 initdb;
sudo vim /var/lib/pgsql96/data/postgresql.conf;
sudo vim /var/lib/pgsql96/data/pg_hba.conf
sudo service postgresql start;

Fedora source

sudo dnf install https://download.postgresql.org/pub/repos/yum/9.6/fedora/fedora-31-x86_64/pgdg-fedora-repo-latest.noarch.rpm
sudo dnf install postgresql96 postgresql96-server postgresql96-devel​ postgresql96-contrib

If that doesn't work try this tutorial. You can probably skip the updating step.s

Update the RPM package

rpm -ivh https://yum.postgresql.org/9.6/redhat/rhel-7.3-x86_64/pgdg-centos96-9.6-3.noarch.rpm

Update packages

yum update

Install Postgres

yum install postgresql96 postgresql96-server postgresql96-libs postgresql96-contrib postgresql96-devel

Initialize the DB

/usr/pgsql-9.6/bin/postgresql96-setup initdb

Start the Postgres service

systemctl enable postgresql-9.6.service
systemctl start postgresql-9.6.service 
  1. Add 2 users. 1 is going to be the "ec2-user" then make another user with all the same credentials and use your username

  2. Clone atila-django

  3. Add Postgres to Django: this tutorial

source install.sh;

  1. Add your environment variables to .env file:

    • Set ATILA_ALLOWED_HOSTS to your cloud 9 URl (it will be of form: <cloud_9_id>.vfs.cloud9.us-east-1.amazonaws.com)

source .env
python manage.py migrate
source start.sh -p 8080

if [ ! -d "venv" ]; then
virtualenv venv --python=python3
fi
cp shared.env .env
source venv/bin/activate
pip install -r requirements.txt
Django==1.11.17 #or you can use the most recent version of django
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment