Python, Django, Postgresql
- Python 3.7.2
- Django 2.1.5
- Postgresql 11
- Install homebrew
- Install python3
brew install python3
- Check python version:
python3 -V
should give python 3.7.2\ - Install Django
pip3 install django
- Check django version:
python3 -m django --version
should give you 2.1.5 - Install postgres
brew install postgresql
- Create runner database in postgres from command line
createdb djangorunner
This will create a database calleddjangorunner
in postgres and we later connect to this db from our python project. - Now you are ready to clone the project from github. I use pycharm community version for coding and terminal for running django commands.
- After cloning the project, open the project in pycharm. Go to
runner/settings.py
and find the following lines:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'djangorunner',
'USER': 'dimple',
'PASSWORD': '******',
'HOST': '127.0.0.1',
'PORT': '5432'
}
}
Change the user and password to your mac user and password. - Now go to the command line and cd into the project.
pip3 install djangorestframework
pip3 install django-filter
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
- On your browser go to
localhost:8000
. You should see rest framework localhost:8000/admin
will give you django administration.