internshipn't is a website where you can search for a job of your dream :)
- Install PostgreSQL
- Install Python dependencies
- Set up database
- Install Django Migrations
- Seed the database (with random data)
- Run the server
Download and install PostgreSQL.
First of all, install all pip dependencies:
$ pip3 install -r requirements.txt
We are using PostgreSQL as our database. PostgreSQL username, password and database are configured in jobnt/jobnt/settings.py
as follows:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'jobnt',
'USER': 'admin',
'PASSWORD': 'admin',
'HOST': '127.0.0.1',
}
}
We need to create:
- PostgreSQL user
'admin'
with password'admin'
- PostgreSQL database
'jobnt'
NOTE: Following assumes you have superuser called postgres
. (Change it accordingly.)
-
Create user
admin
:$ createuser -U postgres admin
-
Give permission to create databases and change password to
'admin'
:# Run PSQL console as superuser $ psql -U postgres # Give createdb permission to admin postgres=# alter user admin createdb; # Change password for admin to 'admin' (without single-quotes) postgres=# alter user admin with password 'admin'; # Quit PSQL console \q
-
Create database
jobnt
:$ createdb -U admin jobnt
Run:
# First, make migrations
python manage.py makemigrations
# Run migrations
python manage.py migrate
(Optional, but recommended) Create a super user (to login to our application):
# Create super-user
python manage.py createsuperuser
# ... enter username, password and optionally email
Instead of manually entering database information, use our seeder to populate the database with fake data:
# Seed
python manage.py seed
Run the server:
python manage.py runserver
Now, go to the address shown in the output for above (usually, localhost:8000) in your browser.