There are 4 images on use: the MySQL image, the Nginx Image, the Django Image, and the React Image.
- Installation
- Structure and Folders
- Environment Variables
- Web Server Config (Nginx)
- Django Config
- React Config
-
Clone the repo from GitHub and start containers:
git clone <repo> cd <repo> cp simple_env_conf.env .env docker-compose build docker-compose up docker-compose run backend ./manage.py collectstatic docker-compose run backend ./manage.py migrate
-
(optional) To access React's project main page go to http://localhost/ while to go to Django Admin follow the link http://localhost/admin.
-
(optional) To create a super-user for Django run
docker-compose run backend ./manage.py createsuperuser
- The mysql_data folder contains the data generated by MySQL Database.
- The Backend folder contains the Django dockerfile and the project is at Backend/django_backend.
- The Frontend folder contains the React dockerfile and the project is at Frontend/react_frontend.
- The Nginx folder contains the Nginx server configuration file and the dockerfile.
- MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DATABASE store the credentials of the database.
- MYSQL_DATA_DIR The directory to store MySQL data (currently mysql_data inside project root folder).
- HOST_MACHINE_X_PORT These variables store the default port for service X.
- The environment variables for the Django Project are at the Backend/django_backend/django_backend/settings/.env file.
The server has been configured such that the Django Admin can be accessed when /admin is used in the Url, and the api_django_app (not created yet) can be accessed whenever /api is used. The rest points to React (except for the static files urls).
The Django project has multiple settings.py files for the different environments: development, testing, production, ...; the current one in use is the dev.py (for the development stage). As the default config, the project uses a MySQL database already configured in the dev.py.
NOTE: There is no app created yet.
The React project has no custom configuration and has been set to the default settings.