/django-docmanager

A django learning exercise

Primary LanguagePython

Django docmanager

A django learning exercise

django-docmanager.herokuapp.com

A restful api for managing documents with django rest framework. No auth/permissions are implemented.

Endpoints

Setup

  1. Clone the repository
git clone git@github.com:pedrossdemelo/django-docmanager.git
  1. Setup the virtual environment
python -m venv .venv && source .venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Install postgresql on your machine

  2. Create a database

createdb docmanager
  1. Create a superuser
python manage.py createsuperuser
  1. Run the server
python manage.py runserver

Deployment

  1. Install the heroku cli
brew install heroku
  1. Create a new heroku app
heroku create

Copy the url of the app to the clipboard, we will use it later.

Keep in mind that the app will be created in the directory where you run the command.

  1. Add free-tier postgresql db to the app
heroku addons:create heroku-postgresql:hobby-dev
  1. Configure the environment variables

Point DJANGO_SETTINGS_MODULE to the heroku settings file.

heroku config:set DJANGO_SETTINGS_MODULE=docmanager.settings.heroku

Add your secret key

heroku config:set SECRET_KEY=<your secret key>

Paste the url of your api to ALLOWED_HOSTS

heroky config:set ALLOWED_HOSTS=<your database url>
  1. Deploy the app and open it in a browser
git push heroku main && heroku open