A Django REST Framework REST API backend for FezComic. This project is prepared to work with MySQL and SQLite and containerized using Docker. For SQLite use master branch and for MySQL use mysql branch
It will be uploaded at some point to serve as a reference.
Requirements:
Additional requirements without using Docker:
Steps without Docker:
Install Python 3 and create a virtual environment
$ python3 -m venv envActivate the virtual environment
$ source env/bin/activateDownload all dependencies
$ pip install -r requirements.txtIf you want to use SQLite, change managed = False to managed = True in models.py and then launch the following commands
$ python manage.py makemigrations FezComicServerPython
$ python manage.py migrateOr if you prefer to use MySQL, run init.sql script on your MySQL database and then create a file named .env with your database configuration:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=yourDatabaseUser
MYSQL_ROOT_PASSWORD=yourDatabaseRootPassword
MYSQL_PASSWORD=yourDatabasePasswordThis file is used by theskumar/python_dotenv library to add those variables to the environment, which settings.py consumes.
Notes:
-
You may use .env.sample as a reference
-
Do not rename
MYSQL_USER,MYSQL_ROOT_PASSWORDandMYSQL_PASSWORDif you are using Docker. Those names are reserved by MySQL Docker image.
Steps using Docker:
Simply build the container
$ docker-compose buildUsage without Docker
Run a local server using your Python3 virtual environment
(env) $ python manage.py runserverUsage with Docker
If you prefer to use MySQL, create a file named .env with your database configuration:
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USER=yourDatabaseUser
MYSQL_ROOT_PASSWORD=yourDatabaseRootPassword
MYSQL_PASSWORD=yourDatabasePasswordThis file is used by theskumar/python_dotenv library to add those variables to the environment, which settings.py consumes.
Notes:
-
You may use .env.sample as a reference
-
Make sure your
MYSQL_HOSTis set todb. Otherwise, Django won't be able to locate the autogenerated database. That is becausedbis the name of the database service defined at docker-compose.yml -
Do not rename
MYSQL_USER,MYSQL_ROOT_PASSWORDandMYSQL_PASSWORDif you are using Docker. Those names are reserved by MySQL Docker image.
Run the container.
$ docker-compose upAlso, if you want to build, run and leave it as a background process, run the following command
$ docker-compose up --build --detachThere is no plan regarding contributions in this project
This web application has been developed by:
Rafael Pernil Bronchalo - Software Architect and Developer
This project is licensed under the MIT License - see the LICENSE.md file for details