-
Notifications
You must be signed in to change notification settings - Fork 4
Local Environment Setup
Basim Ramadhan edited this page Sep 6, 2017
·
8 revisions
The following instructions assume you are using Ubuntu.
- Ensure Python 3.6 is installed:
python3.6 -V
- Installing Python 3.6 on Ubuntu >16.04:
sudo apt-get update
sudo apt-get install python3.6 python3.6-dev
- Installing Python 3.6 on Ubuntu 16.04:
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6 python3.6-dev
- Install virtualenv:
sudo apt install virtualenv
- Install Postgres:
sudo apt-get install postgresql postgresql-contrib
- recommended GUI:
sudo apt-get install pgadmin3
- enter the database as the
postgres
user:sudo su - postgres psql
- set your own password for the
postgres
database role:\password postgres
- set up the database:
CREATE DATABASE projectlovelace;
CREATE USER admin WITH PASSWORD 'foobar';
ALTER ROLE admin SET client_encoding TO 'utf8';
ALTER ROLE admin SET default_transaction_isolation TO 'read committed';
-
ALTER ROLE admin SET timezone TO 'UTC';
(confirm that Django setting USE_TZ isTrue
) GRANT ALL PRIVILEGES ON DATABASE projectlovelace TO admin;
\q
- start Postgres on login:
sudo systemctl enable postgresql
- Clone the lovelace-website repo:
cd dir-of-your-choice
git clone https://github.com/project-lovelace/lovelace-website.git
cd lovelace-website
- Download dependencies and create the virtual Python environment:
make prepare-venv
- Activate the virtual environment:
source env/bin/activate
- Set up the development web server:
cd src
- create necessary tables in the database:
python manage.py migrate
- download sample data: https://gist.github.com/basimr/8398cc6272678180e77335603e156bd2
- import the sample data:
python manage.py loaddata dump.json
- start the development web server:
python manage.py runserver
- check out the website: http://localhost:8000
- check out the Django admin: http://localhost:8000/admin (admin / foobaradmin)
- Install PyCharm Community:
- download: https://www.jetbrains.com/pycharm/download/#section=linux
- follow installation instruction on the JetBrains website
- TODO: make page for PyCharm setup
- Set up PyCharm: