Open-source Django project that showcases the API Generator and other Dynamic Services - actively supported by App-Generator.
- 👉 Django - Build Services without Coding -
video presentation(learn how to use this starter)
For a complete set of features and long-term support, check out Dynamic Django, a powerful starter that incorporates:
- ✅ Dynamic DataTables: using a single line of configuration, the data saved in any table is automatically managed
- ✅ Dynamic API: any model can become a secure API Endpoint using DRF
- ✅ Dynamic Charts: extract relevant charts without coding all major types are supported
- ✅ CSV Loader: translate CSV files into Django Models and (optional) load the information
- ✅ Powerful CLI Tools for the GIT interface, configuration editing, updating the configuration and database (create models, migrate DB)
👉 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 --buildVisit 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 runserverAt 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 Requestsare 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,Updaterequires 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_GENERATORsection - 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 App-Generator