|
|
5年前 | |
|---|---|---|
| mysql | 6年前 | |
| src | 5年前 | |
| .env | 5年前 | |
| .gitignore | 6年前 | |
| README.md | 5年前 | |
| app_structure.png | 6年前 | |
| docker-compose.yml | 6年前 | |
Python webpy application running on uswgi server with nginx using docker connected to another docker-runned mysql database.
Web Server image base: https://github.com/tiangolo/uwsgi-nginx-docker
webpy framework: http://webpy.org/
git clone <repositoryURL>
IMPORTANT Windows users must use:
git clone <repositoryURL> --config core.autocrlf=input
docker-compose up
Upon changes in the code the docker image must be built again for the changes to take effect. Some changes might not get reflected even on build, which is when the --force-recreate attribute can be used.
$ docker-compose up --build
If you need a completely fresh rebuild (WARNING this will remove all your docker images). This will reset the images including the database which is not necessary affected by only rebuilding the images
$ docker system prune -a
$ docker-compose up
The ip and ports for the web server and database is set with the .env file using the groupid variable.
Running the application outside of containers might be useful for development because the images does not need to be rebuilt for every change in the code. This is optional.
mysql server
python =< 3.6.8
python packages: src/app/requirements.txt
Launch mysql at default port (3306)
$ systemctl start mysqld
Log in to database
$ sudo mysql -u root
Insert mysql queries:
CREATE database db;
USE db;
SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘root’);
GRANT ALL PRIVILEGES ON db.* TO ‘root’@‘localhost’;
Then populate databse by posting mysql/sql/init.sql into mysql
Edit src/app/models/database.py to point at local database server
$ cd src/app/
$ python3 src/app/main.py