Initial dockerization
This commit is contained in:
parent
e97b776c2e
commit
70676e69b5
@ -22,3 +22,7 @@ An attempt to create search and rescue database for logging SAR jobs and activit
|
|||||||
# Update the .po files with new translations
|
# Update the .po files with new translations
|
||||||
...
|
...
|
||||||
pybabel compile -d translations
|
pybabel compile -d translations
|
||||||
|
|
||||||
|
# How to run the application with docker-compose
|
||||||
|
|
||||||
|
docker-compose up --build
|
||||||
|
4
app.py
4
app.py
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
from flask import Flask, redirect, url_for, request, session
|
from flask import Flask, redirect, url_for, request, session
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
@ -25,7 +26,8 @@ def get_locale():
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['SECRET_KEY'] = 'secret_key'
|
app.config['SECRET_KEY'] = 'secret_key'
|
||||||
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
|
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp'
|
#app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp'
|
||||||
|
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp')
|
||||||
app.config['BABEL_DEFAULT_LOCALE'] = 'en'
|
app.config['BABEL_DEFAULT_LOCALE'] = 'en'
|
||||||
babel= Babel(app)
|
babel= Babel(app)
|
||||||
babel.init_app(app, locale_selector=get_locale)
|
babel.init_app(app, locale_selector=get_locale)
|
||||||
|
@ -8,7 +8,7 @@ services:
|
|||||||
- db
|
- db
|
||||||
environment:
|
environment:
|
||||||
- FLASK_ENV=development
|
- FLASK_ENV=development
|
||||||
- DATABASE_URL=mysql+pymysql://username:password@db/mydatabase
|
- DATABASE_URL=mysql+mysqlconnector://sarbaseuser:password@db/sarbaseapp
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
@ -16,9 +16,9 @@ services:
|
|||||||
- db-data:/var/lib/mysql
|
- db-data:/var/lib/mysql
|
||||||
- ./init-db:/docker-entrypoint-initdb.d
|
- ./init-db:/docker-entrypoint-initdb.d
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: rootpassword
|
MYSQL_ROOT_PASSWORD: password
|
||||||
MYSQL_DATABASE: mydatabase
|
MYSQL_DATABASE: sarbaseapp
|
||||||
MYSQL_USER: username
|
MYSQL_USER: sarbaseuser
|
||||||
MYSQL_PASSWORD: password
|
MYSQL_PASSWORD: password
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user