A restful api for managing documents with django rest framework. No auth/permissions are implemented.
- /docs
GET / POST documents
- /docs/:uuid4
GET / PUT / DELETE a document
- /companies
GET / POST companies
- /companies/:name
GET / PUT / DELETE a company
- /companies/:name/docs
GET documents from a company
- /companies/id/:id
GET / PUT / DELETE a company
- /companies/id/:id/docs
GET documents from a company
- /users
GET / POST users
- /users/:email
GET / PUT / DELETE a user
- /users/id/:id
GET / PUT / DELETE a user
- /users/:email/docs
GET documents from a user
- /users/id/:id/docs
GET documents from a user
- Clone the repository
git clone git@github.com:pedrossdemelo/django-docmanager.git
- Setup the virtual environment
python -m venv .venv && source .venv/bin/activate
- Install dependencies
pip install -r requirements.txt
-
Create a database
createdb docmanager
- Create a superuser
python manage.py createsuperuser
- Run the server
python manage.py runserver
brew install heroku
- 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.
- Add free-tier postgresql db to the app
heroku addons:create heroku-postgresql:hobby-dev
- 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>
- Deploy the app and open it in a browser
git push heroku main && heroku open