python
, else replace all example python
commands with python3
)mkdir wecodeafrica
cd wecodeafrica
git clone https://github.com/wecodeafrica/backend
cd backend
mkdir backend/staticfiles
virtualenv --python={PATH_TO_PYTHON3.6} dcmpa
source dcmpa/bin/activate
pip install -r requirements.txt
If you get an error, you may need to open the requirements.txt
file and replace psycopg2==2.8.2
with psycopg2-binary==2.8.3
Create a postgres databse by typing
createdb Dcmpa
When you are ready to exit Postgres, type \q
and then Enter
Create a new user, you can do by by typing
createuser postgres --interactive --pwprompt
after which you will be prompted to create a new user.
Copy the example .env file:
cp .env.example .env
Open the .env file and provide values for every variable with the value of changeme
.
nano .env
Use the username, user password, and database name, for the postgres database you just created in the variables POSTGRES_DB_NAME
, POSTGRES_DB_USER
, and POSTGRES_USER_PASSWORD
(change the variables)
(save the .env file)
Set the environmental variables
set -a && source .env && set +a
Make a migrations file to change your new database schema:
python manage.py makemigrations
Make a migrations file to change your new database schema:
python manage.py migrate
Make yourself a super user:
python manage.py createsuperuser
collect static, so you can run the django admin. You will run this command when you add or update static files:
python manage.py collectstatic
Run the server
python manage.py runserver
Navigate to the django admin:
http://localhost:8000/admin/
If you see a login screen, everything worked!