API: use of PostgreSQL instead of MySQL
API: use of PostgreSQL instead of MySQL
This commit is contained in:
parent
81b1370b5e
commit
a8faabddc3
1
Makefile
1
Makefile
@ -15,6 +15,7 @@ install-client:
|
||||
$(NPM) install
|
||||
|
||||
install-python:
|
||||
test -d $(VENV) || virtualenv $(VENV) -p $(PYTHON_VERSION)
|
||||
$(PIP) install -r $(REQUIREMENTS)
|
||||
|
||||
serve-python:
|
||||
|
@ -6,6 +6,8 @@ export REACT_APP_API_URL ?= http://$(HOST):$(API_PORT)/api/
|
||||
export FLASK_APP ?= $(PWD)/mpwo_api/server.py
|
||||
export TEST_URL ?= http://$(HOST):$(CLIENT_PORT)
|
||||
export REQUIREMENTS ?= $(PWD)/mpwo_api/requirements.txt
|
||||
export DATABASE_URL ?= postgres://mpwo:mpwo@$(HOST):5432/mpwo
|
||||
export DATABASE_TEST_URL ?= postgres://mpwo:mpwo@$(HOST):5432/mpwo_test
|
||||
|
||||
# Python env
|
||||
PYTHON_VERSION ?= python
|
||||
|
@ -1,6 +0,0 @@
|
||||
CREATE DATABASE IF NOT EXISTS mpwo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE DATABASE IF NOT EXISTS mpwo_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
CREATE USER 'mpwo'@'localhost' IDENTIFIED BY 'mpwo';
|
||||
GRANT ALL PRIVILEGES ON `mpwo` . * TO 'mpwo'@'localhost';
|
||||
GRANT ALL PRIVILEGES ON `mpwo_dev` . * TO 'mpwo'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
5
mpwo_api/db/mpwo.sql
Normal file
5
mpwo_api/db/mpwo.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE DATABASE mpwo;
|
||||
CREATE DATABASE mpwo_test;
|
||||
CREATE USER mpwo WITH PASSWORD 'mpwo';
|
||||
GRANT ALL PRIVILEGES ON DATABASE mpwo TO mpwo;
|
||||
GRANT ALL PRIVILEGES ON DATABASE mpwo_test TO mpwo;
|
@ -20,7 +20,7 @@ class DevelopmentConfig(BaseConfig):
|
||||
"""Development configuration"""
|
||||
DEBUG = True
|
||||
SQLALCHEMY_DATABASE_URI = \
|
||||
'mysql+mysqldb://mpwo:mpwo@127.0.0.1:3306/mpwo'
|
||||
os.environ.get('DATABASE_URL')
|
||||
SECRET_KEY = 'development key'
|
||||
USERNAME = 'admin'
|
||||
PASSWORD = 'default'
|
||||
@ -31,7 +31,7 @@ class TestingConfig(BaseConfig):
|
||||
"""Development configuration"""
|
||||
DEBUG = True
|
||||
SQLALCHEMY_DATABASE_URI = \
|
||||
'mysql+mysqldb://mpwo:mpwo@127.0.0.1:3306/mpwo_test'
|
||||
os.environ.get('DATABASE_TEST_URL')
|
||||
SECRET_KEY = 'test key'
|
||||
USERNAME = 'admin'
|
||||
PASSWORD = 'default'
|
||||
|
@ -14,6 +14,7 @@ Jinja2==2.10
|
||||
MarkupSafe==1.0
|
||||
mccabe==0.6.1
|
||||
mysqlclient==1.3.12
|
||||
psycopg2==2.7.3.2
|
||||
pycodestyle==2.3.1
|
||||
pycparser==2.18
|
||||
pyflakes==1.6.0
|
||||
|
Loading…
Reference in New Issue
Block a user