Load data with python manage.py loaddata workouts (or just run a createWorkout mutation 😉)
GraphQL playground at http://127.0.0.1:8000/graphql
Sample queries in queries.txt
Sample mutations in mutations.txt
- Make database
- Create virtual environment
- Install pip requirements
- Run Django migration
- Create project superuser
- Run server
- Setup PyCharm
Check if postgres client exists
pg_config
Inside PSQL:
CREATE DATABASE db;
CREATE USER postgres WITH ENCRYPTED PASSWORD 'postgres';
GRANT ALL PRIVILEGES ON DATABASE db TO postgres;
To check if database is created:
\c db
\dt
Inside backend folder:
python -m pip install virtualenv
python -m virtualenv --version
python -m virtualenv venv
To activate (on Windows): .\venv\Scripts\activate or source '.\venv\Scripts\activate'
To activate (on Mac): source venv/bin/activate
Deactivate: deactivate
Inside backend folder
python -m pip install -r requirements.txt
You want to do this everytime there is a model change.
Inside backend/planfierce
python manage.py makemigrations
python manage.py migrate
If you run \dt in PSQL, you should see tables created.
python manage.py createsuperuser
Remember the username and password for access to admin!
Will run at http://127.0.0.1:8000/
Admin panel at http://127.0.0.1:8000/admin
Play with GraphQL at http://127.0.0.1:8000/graphql
python manage.py runserver
Open Project --> folder backend/planfierce
To link to your virtual environemnt:
- Go into Settings --> Project: Planfierce --> Project Interpreter
- Change project interpreter to your venv (Existing Interpreter -->
\venv\Scripts\python.exe)