Create a REST API endpoints with Authentication and Registration
Project description
drf-microservice
A POC of a DRF microservice
!!!DON"T USE IT IN PRODUCTION, It's in development!!!
Something disturb you in the code? Don't hesitate to submit a pull request and contribute.
Releases Notes
- 0.5.1: fix some document presentation on github and pypi
- 0.5.0: Initial publication version
AWS secret required
APPNAME_USERNAME_PASSWD => a client API password
SECRET_KEY => the secret key
ENV required
AWS_REGION_NAME => default="eu-east-1"
AWS_APPNAME_SECRET_NAME =>The name of the secret bucket
To install
todo
git clone xxx
cd xxx
python3 -m venv /pass/to/venev
source /pass/to/venev/bin/activate
python setup.py test
python manage.py migrate
SECRET_KEY=xxx python manage.py test
API
To see the documentation for the API In development mode, login at
http://127.0.0.1:8000/rest-auth/login/
Actually the default mode is "development" (same to the state of this project) in that mode a default login is the the db with username='admin' password='admin' you will get back in return your token.
Then open
http://127.0.0.1:8000/docs/
testing
You can run the tests by:
SECRET_KEY=xxx python manage.py test
or by
python setup.py test
or by
DJANGO_SETTINGS_MODULE=project.settings SECRET_KEY=xxx pytest
Security check
Before dockerization for deployment to production, don't forget to check if by
SECRET_KEY="MySecret" python manage.py check --deploy
Build and run the image with Docker
Build the Docker image:
docker build -t my-drf -f Dockerfile.drf-microservice .
docker build -t my-nginx -f Dockerfile.nginx .
Run the container:
docker network create my-network
docker run -d --name drf --net my-network -v /app my-drf
docker run -d --name nginx --net my-network -p "5000:80" my-nginx
If you want to change the port binding, it's here...
Build and run wit docker-compose
docker-compose up
DONE
- support basic auth
- support token auth
- endpoint json file POST,GET
- endpoint login/logout
- endpoint get tocken
TODO
- AWS ssm secret
- add getSentry support
- endpoint json file DELETE,PUT?
- add some strong auth
- create differents version:
- S3
- RDS
- postgreSQL
- Redis
- Aerospike
- ...
for different use-case
- create the docker-image file
- create the ansible file
- create the terraform file
- create the kubertes file
- create the Juju file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for drf_microservice-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50901cc4a1aadee3adebc5e3b9e6dd7f7259e96a01b033a7307d2d389017403d |
|
MD5 | f09328d8d97d3a4e2a2be448b8e2760f |
|
BLAKE2b-256 | 689beff323db2ae8cee0b484134d80e877b220ae4edd172a4efa0009faec90a0 |
Hashes for drf_microservice-0.5.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e875ac9e09a6be3469bc283e02481019cc1401a0330018f888f41d7d30ee2a6 |
|
MD5 | 863d0209a4d6057a821afba16609b754 |
|
BLAKE2b-256 | 5834b324670be68d4728aee2e1eaa10d5a1b26eb0ae67447a2604f6752b349e2 |