Open-source Django project that showcases the API Generator and other Dynamic Services - actively supported by AppSeed.
๐ Django - Build Services without Coding -
video presentation
(learn how to use this starter)
- โ
Up-to-date Dependencies
- โ
Theme: Django AdminLTE
v3.2.0
- โ
API Generator -
Free Python Library
- โ
Dynamic DataTables -
Free Python Library
- ๐
Deployment
: Docker,CI/CD
flow viaRender
๐ Step 1 - Download the code from the GH repository (using
GIT
)
$ git clone https://github.com/app-generator/django-dynamic-services.git
$ cd django-dynamic-services
๐ Step 2 - Start the APP in
Docker
$ docker-compose up --build
Visit http://localhost:5085
in your browser. The app should be up & running.
๐ Step 3 - Create Superuser in
Docker
$ # List containes & get the ID
$ docker container ls
$ # Create the superuser
$ docker exec <CONTAINER_ID> python manage.py createsuperuser
๐ Download the code
$ git clone https://github.com/app-generator/django-dynamic-services.git
$ cd django-dynamic-services
๐ Install modules via
VENV
$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt
๐ Set Up Database
$ python manage.py makemigrations
$ python manage.py migrate
๐ Generate API
$ python manage.py generate-api # requires confirmation
//
$ python manage.py generate-api -f # no input (API folder is overwritten)
๐ Create the Superuser
$ python manage.py createsuperuser
๐ Start the app
$ python manage.py runserver
At this point, the app runs at http://127.0.0.1:8000/
and the generated API can be found at:
- http://localhost:8000/api/product/ - For
products
- http://localhost:8000/api/sales/ - For
sales
The default API nodes can be tested via this POSTMAN Collection.
- Start the app
- Make sure the endpoints are up & running
- Authenticate via API and het the access token
http://localhost:8000/login/jwt/
usind existing credentials- Save the token in the requests
HEADER
GET Requests
are public (no token required)- GET ALL products:
http://localhost:8000/api/product/
- GET product by ID:
http://localhost:8000/api/product/1/
- GET ALL Sales:
http://localhost:8000/api/sales/
- GET ALL products:
Create
,Delete
,Update
requires a token in the header
For API sample requests, open and edit the POSTMAN Collection sample.
- Define or update your models
- Migrate the database
- Update the configuration
API_GENERATOR
section - Regenerate the API
python manage.py generate-api
At this point, you should be able to use the API. For more information regarding the library used to generate the code, access:
๐ API Generator for Django - Open-Source Library
The project is coded using a simple and intuitive structure presented below:
< PROJECT ROOT >
|
|-- core/
| |-- settings.py # Project Configuration
| |-- urls.py # Project Routing
|
|-- home/
| |-- views.py # APP Views
| |-- urls.py # APP Routing
| |-- models.py # APP Models
| |-- tests.py # Tests
| |-- templates/ # Theme Customisation
| |-- includes #
| |-- footer.py # Custom Footer
|
|-- requirements.txt # Project Dependencies
|
|-- env.sample # ENV Configuration (default values)
|-- manage.py # Start the app - Django default start script
|
|-- ************************************************************************
Django Dynamic Services - Open-Source Django starter provided by AppSeed