Update README.md

This commit is contained in:
saqibur 2022-08-09 11:04:56 +06:00
parent 4a57db71bb
commit f730736a7b
2 changed files with 53 additions and 59 deletions

112
README.md
View File

@ -5,64 +5,63 @@ either strictly through the `django-rest-framework` or just `django`.
The project is meant to be easily clonable, and used as the starter template for The project is meant to be easily clonable, and used as the starter template for
the next big thing our team develops. the next big thing our team develops.
## Getting Started
1. Clone the repo from GitHub/BitBucket
1. Delete the `.git` folder
1. Remove/add anything as you see fit
1. Initialize as a new git repository for your own project
1. DONE.
### Creating an App
1. Create a folder with the app name in `apps`. For example: `poll`
1. Run `python manage.py startapp poll apps/poll` from the root directory of the project
## Scope ## Scope
Develop a structure for both `django-rest-framework` and `django` projects. - Goal: Develop a structure for both `django-rest-framework` and `django` projects.
Easily clonable when starting new projects - Easily clonable when starting new projects
Folder structure only, not “best practices” - Folder structure only, not “best practices”
No questions, instead well have everything raised as an issue in a repository - We wont be enforcing about best practices in implementation details
We wont be talking about best practices in implementation details - Well hold all questions in a GitHub repository, so things can move forward
Well hold all questions in a GitHub repository, so things can move forward - The discussions also serve historic significance - people can backtrack why some decisions were made.
The discussions also serve historic significance - people can backtrack why some
decisions were made.
## Project Tree ## Project Tree
```bash ```bash
. .
├── apps ├── apps
│ ├── app_one # A Django Rest Framework Project │ └── example_api # A django rest app
│ │ ├── api │ ├── api
│ │ │ ├── v1 │ │ ├── v1
│ │ │ │ ├── __init__.py │ │ │ ├── __init__.py
│ │ │ │ ├── serializers.py │ │ │ ├── serializers.py
│ │ │ │ ├── services.py │ │ │ ├── services.py
│ │ │ │ ├── tests.py │ │ │ ├── tests.py
│ │ │ │ ├── urls.py │ │ │ ├── urls.py
│ │ │ │ └── views.py │ │ │ └── views.py
│ │ │ ├── v2 │ │ ├── v2
│ │ │ │ ├── __init__.py │ │ │ ├── __init__.py
│ │ │ │ ├── serializers.py │ │ │ ├── serializers.py
│ │ │ │ ├── services.py │ │ │ ├── services.py
│ │ │ │ ├── tests.py │ │ │ ├── tests.py
│ │ │ │ ├── urls.py │ │ │ ├── urls.py
│ │ │ │ └── views.py │ │ │ └── views.py
│ │ │ └── __init__.py │ │ └── __init__.py
│ │ ├── management │ ├── management
│ │ │ ├── commands.py │ │ ├── commands
│ │ │ └── __init__.py │ │ │ └── command.py
│ │ ├── migrations │ │ └── __init__.py
│ │ │ └── __init__.py
│ │ ├── templates
│ │ ├── tests
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── __init__.py
│ │ ├── models.py
│ │ ├── urls.py
│ │ ├── utils.py
│ │ └── views.py
│ └── app_two # A normal Django project
│ ├── migrations │ ├── migrations
│ │ └── __init__.py │ │ └── __init__.py
│ ├── templates │ ├── templates
│ ├── tests
│ ├── admin.py │ ├── admin.py
│ ├── apps.py │ ├── apps.py
│ ├── __init__.py │ ├── __init__.py
│ ├── models.py │ ├── models.py
│ ├── service.py
│ ├── tests.py
│ ├── urls.py │ ├── urls.py
│ ├── utils.py
│ └── views.py │ └── views.py
├── config ├── config
│ ├── settings │ ├── settings
@ -106,16 +105,13 @@ decisions were made.
Each `app` should be designed in way to be pluggable, that is, dragged and dropped Each `app` should be designed in way to be pluggable, that is, dragged and dropped
into any other project and itll work independently. into any other project and itll work independently.
* We wont have a `core` in our projects. This should be maintained separately
and versioned accordingly as a library.
### `apps` ### `apps`
* A mother-folder containing all apps for our project. * A mother-folder containing all apps for our project. Congruent to any JS-framework's `src` folder.
* An app can be a django template project, or an api * An app can be a django template project, or an API.
#### `api` ### `api`
* We like to place all our API components into a package within an app called * We like to place all our API components into a package within an app called
api/. That allows us to isolate our API components in a consistent location. If `api`. For example, in this repository it's the `example_api/api` folder. That allows us to isolate our API components in a consistent location. If
we were to put it in the root of our app, then we would end up with a huge list we were to put it in the root of our app, then we would end up with a huge list
of API-specific modules in the general area of the app. of API-specific modules in the general area of the app.
@ -125,7 +121,7 @@ within each relevant app, sometimes it makes more sense to build an app
specifically for the API. This is where all the serializers, renderers, and views specifically for the API. This is where all the serializers, renderers, and views
are placed. Therefore, the name of the app should reflect its API version are placed. Therefore, the name of the app should reflect its API version
##### `api-versioning` ### `api-versioning`
It might often be necessary to support multiple versions of an API throughout the lifetime of a project. Therefore, we're adding in support right from the start. It might often be necessary to support multiple versions of an API throughout the lifetime of a project. Therefore, we're adding in support right from the start.
For different API versions, we're assuming the following will change: For different API versions, we're assuming the following will change:
@ -134,23 +130,22 @@ For different API versions, we're assuming the following will change:
- URLs - URLs
- Services - Services
Whereas the `model`s will be shared. `model`s can be thought of as shared between versions. Therefore, migrating changes should be versioned carefully without breaking different versions of the API.
* How do you define a version 2?
### What's Version 2?
Currently we're proposing that major changes to the following, constitutes a new API version: Currently we're proposing that major changes to the following, constitutes a new API version:
1. Representation of data, either for submission or retrieval 1. Representation of data, either for submission or retrieval
2. Major optimizations 1. Major optimizations
3. Major code reorganization and code refactor 1. Major code reorganization and code refactor
### `config` ### `config`
* Contains project configuration files, including the primary URL file * Contains project configuration files, including the primary URL file
* Contains settings split into `base`, `local`, `production` and `development` * Contains settings split into `base`, `local`, `production` and `development`.
### `deployments` ### `deployments`
* Contains Docker and nginx specific files for deploying in different * Contains Docker, Docker-Compose and nginx specific files for deploying in different
environments environments
@ -158,7 +153,7 @@ environments
* Well have CHANGELOG.md * Well have CHANGELOG.md
* Well have CONTRIBUTING.md * Well have CONTRIBUTING.md
* Well have deployment instructions * Well have deployment instructions
* Well have local instructions * Well have local startup instructions
### `services` ### `services`
@ -175,4 +170,3 @@ environments
- [Cookiecutter Django](https://github.com/cookiecutter/cookiecutter-django) - [Cookiecutter Django](https://github.com/cookiecutter/cookiecutter-django)
- [HackSoft Django Style Guide](https://github.com/HackSoftware/Django-Styleguide) - [HackSoft Django Style Guide](https://github.com/HackSoftware/Django-Styleguide)
- [Radoslav Georgiev - Django Structure for Scale and Longevity](https://www.youtube.com/watch?v=yG3ZdxBb1oo) - [Radoslav Georgiev - Django Structure for Scale and Longevity](https://www.youtube.com/watch?v=yG3ZdxBb1oo)
- Vaccina Backend Projects (namely `backend-healthcheck`)