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
|
||||
...
|
||||
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_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
@ -25,7 +26,8 @@ def get_locale():
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'secret_key'
|
||||
#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'
|
||||
babel= Babel(app)
|
||||
babel.init_app(app, locale_selector=get_locale)
|
||||
|
@ -8,7 +8,7 @@ services:
|
||||
- db
|
||||
environment:
|
||||
- FLASK_ENV=development
|
||||
- DATABASE_URL=mysql+pymysql://username:password@db/mydatabase
|
||||
- DATABASE_URL=mysql+mysqlconnector://sarbaseuser:password@db/sarbaseapp
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
@ -16,9 +16,9 @@ services:
|
||||
- db-data:/var/lib/mysql
|
||||
- ./init-db:/docker-entrypoint-initdb.d
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpassword
|
||||
MYSQL_DATABASE: mydatabase
|
||||
MYSQL_USER: username
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: sarbaseapp
|
||||
MYSQL_USER: sarbaseuser
|
||||
MYSQL_PASSWORD: password
|
||||
|
||||
volumes:
|
||||
|
Loading…
Reference in New Issue
Block a user