Skip to content

YunZhi246/PlanFierce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PlanFierce!

Backend Development

GraphQL Steps:

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

Setup Steps:

  1. Make database
  2. Create virtual environment
  3. Install pip requirements
  4. Run Django migration
  5. Create project superuser
  6. Run server
  7. Setup PyCharm

Make database

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

Create virtual environment

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

Install pip requirements

Inside backend folder

python -m pip install -r requirements.txt

Run Django migration

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.

Create project superuser

python manage.py createsuperuser

Remember the username and password for access to admin!

Run server

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

Setup PyCharm

Open Project --> folder backend/planfierce
To link to your virtual environemnt:

  1. Go into Settings --> Project: Planfierce --> Project Interpreter
  2. Change project interpreter to your venv (Existing Interpreter --> \venv\Scripts\python.exe)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors