0% found this document useful (0 votes)
78 views2 pages

Setup PDF

This document provides instructions for setting up a Django project with a PostgreSQL database on a Linux system. It describes how to clone a repo, create a Python virtual environment, install requirements, set up a PostgreSQL database with a user and create a database, apply Django migrations, and create a superuser. It concludes by explaining how to launch the development server and view the app.

Uploaded by

Anupam Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views2 pages

Setup PDF

This document provides instructions for setting up a Django project with a PostgreSQL database on a Linux system. It describes how to clone a repo, create a Python virtual environment, install requirements, set up a PostgreSQL database with a user and create a database, apply Django migrations, and create a superuser. It concludes by explaining how to launch the development server and view the app.

Uploaded by

Anupam Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Setup

1. Clone the repo and cd into it


2. Create a Python 3 virtual environment

sudo apt install python3-dev python-virtualenv


virtualenv --python=/usr/bin/python3 ve

ve is the name of the virtual environment

3. Activate the virtual environment

source ve/bin/activate

4. Install the requirements

pip install -r requirements.txt

Create a PostgreSQL database

1. Install PostgreSQL

sudo apt install postgresql postgresql-contrib libpq-dev

2. Open the PostgreSQL shell

sudo -u postgres psql postgres

3. Create a user with the name dev

CREATE USER dev;

4. Create a database with the name ems

CREATE DATABASE ems OWNER dev;

Now exit the PostgreSQL shell by entering \q. You should be back in the shell with
ve activated

5. Apply migrations

python3 manage.py migrate

Create Django superuser

python3 manage.py createsuperuser --username admin

Setup is now complete! 🎉

Launch
First, make sure that the virtual environment we created, i.e. ve, is activated. Then run

python3 manage.py runserver

Once the development server has started, you may visit http://127.0.0.1:8000/ to check out
the app.

You might also like