A lot of small errors fixed on deployment, some things work different with mysql and MariaDB

This commit is contained in:
Daniel Schick 2023-06-27 11:32:50 +02:00
parent 3f211919af
commit d2c84f8d68
7 changed files with 26 additions and 6 deletions

View File

@ -1,5 +1,7 @@
CREATE DATABASE `bremen_calling` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `bremen_calling`
CREATE TABLE `participant` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL,

View File

@ -18,9 +18,11 @@
-- Dumping data for table `berth`
--
USE `bremen_calling`;
LOCK TABLES `berth` WRITE;
/*!40000 ALTER TABLE `berth` DISABLE KEYS */;
INSERT INTO `berth` (`id`, `name`) VALUES (1,'Roland Mühle'),(1,'Stahlwerk'),(2,'Kellogs');
INSERT INTO `berth` (`id`, `name`) VALUES (1,'Roland Mühle'),(2,'Stahlwerk'),(3,'Kellogs');
/*!40000 ALTER TABLE `berth` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -5,11 +5,13 @@ import json
bp = Blueprint('ships', __name__)
@bp.route('/ships', methods=['get'])
@auth_guard() # no restriction by role
def GetShips():
if 'Authentication' in request.headers:
token = request.headers.get('Authentication')
if 'Authorization' in request.headers:
token = request.headers.get('Authorization')
return impl.ships.GetShips(token)
else:
return json.dumps("not authenticated"), 403

View File

@ -5,5 +5,6 @@
"password" : "HalloWach23",
"pool_name" : "brecal_pool",
"pool_size" : 20,
"database" : "bremen_calling"
"database" : "bremen_calling",
"autocommit" : true
}

View File

@ -28,5 +28,5 @@ def initPool():
except mysql.connector.PoolError as e:
logging.error(f"Failed to create connection pool: {e}")
print(e)
except e:
except Exception as e:
print(e)

View File

@ -161,6 +161,7 @@ class Ship(Schema):
name: str
imo: int
callsign: str
participant_id: int
length: float
width: float
created: datetime

12
src/server/flaskapp.wsgi Normal file
View File

@ -0,0 +1,12 @@
import sys
import logging
sys.path.insert(0, '/var/www/brecal/server')
sys.path.insert(0, '/var/www/brecal/venv/lib/python3.10/site-packages/')
# Set up logging
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
# Import and run the Flask app
from BreCal import create_app
application = create_app()