Setting up Backend Server
Grab all the tools:
Before spinning up the backend server we would need the following tools to be installed so that we can create a development environment for The Dev starter Backend template to spin up.
1. PostgreSQL
MacOs
- Install Homebrew official docs
- Install Postgres
- Start Postgresql
- Create a database for your project
PermissionDenied for Creating Schema
if you’re facing errors like
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (permission denied for schema public
then select the db you created above and run the follwoing commands in the database server.
Once we have the database created we need to set the env variables corresponding to <user name> , <project name> and <password>
in the backend env, we can create the virtual environment for the backend project using poetry
2. Poetry
The DevStarter Backend boilerplate uses poetry to create and manage the dependencies since it helps with maintaining the dependencies using a lock file and helps in long run to keep the dependencies clean and running with right versions. official Installation docs
to install poetry on (Linux, macOS, Windows (WSL)) ,
Windows (Powershell)
once poetry is installed we can create a virtual environment with the following commands
once the dependencies have been installed we can start the development server using:
once the server is starter we can explore the swagger docs for the API at http://localhost:8000/api/docs
now to access the API and admin we need to create database migrations and a superuser:
create a superuser following the CLI prompts and then you can explore the admin at localhost:8000/admin