-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from brondsem/py3
Update to python3, latest packages, latest OS!
- Loading branch information
Showing
16 changed files
with
238 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Flask | ||
Flask-SQLAlchemy | ||
gunicorn | ||
Jinja2 | ||
Pillow | ||
SQLAlchemy | ||
timeago | ||
Werkzeug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,40 @@ | ||
certifi==2019.6.16 | ||
chardet==3.0.4 | ||
Click==7.0 | ||
Flask==1.1.1 | ||
Flask-SQLAlchemy==2.4.0 | ||
gunicorn==19.9.0 | ||
idna==2.8 | ||
itsdangerous==1.1.0 | ||
Jinja2==2.10.1 | ||
MarkupSafe==1.1.1 | ||
Pillow==6.1.0 | ||
requests==2.22.0 | ||
SQLAlchemy==1.3.6 | ||
timeago==1.0.15 | ||
urllib3==1.25.3 | ||
Werkzeug==0.15.5 | ||
# This file was autogenerated by uv via the following command: | ||
# uv pip compile requirements.in -o requirements.txt | ||
blinker==1.9.0 | ||
# via flask | ||
click==8.1.8 | ||
# via flask | ||
flask==3.1.0 | ||
# via | ||
# -r requirements.in | ||
# flask-sqlalchemy | ||
flask-sqlalchemy==3.1.1 | ||
# via -r requirements.in | ||
gunicorn==23.0.0 | ||
# via -r requirements.in | ||
itsdangerous==2.2.0 | ||
# via flask | ||
jinja2==3.1.5 | ||
# via | ||
# -r requirements.in | ||
# flask | ||
markupsafe==3.0.2 | ||
# via | ||
# jinja2 | ||
# werkzeug | ||
packaging==24.2 | ||
# via gunicorn | ||
pillow==11.1.0 | ||
# via -r requirements.in | ||
sqlalchemy==2.0.36 | ||
# via | ||
# -r requirements.in | ||
# flask-sqlalchemy | ||
timeago==1.0.16 | ||
# via -r requirements.in | ||
typing-extensions==4.12.2 | ||
# via sqlalchemy | ||
werkzeug==3.1.3 | ||
# via | ||
# -r requirements.in | ||
# flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
# -*- coding: utf-8 -*- | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,55 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
import os | ||
import sys | ||
import traceback | ||
|
||
from waznexserver import db | ||
import models | ||
import config | ||
import models | ||
from models import db | ||
from waznexserver import create_app | ||
|
||
if __name__ == '__main__': | ||
# Create data dirs | ||
|
||
def create_data_dirs(): | ||
data_folders = [df for df in dir(config) if df.endswith('_FOLDER')] | ||
for folder in data_folders: | ||
newdir = os.path.abspath(getattr(config, folder)) | ||
print newdir | ||
print(newdir) | ||
if not os.path.exists(newdir): # If it doesn't exist, try to make it | ||
try: | ||
os.mkdir(newdir) | ||
except OSError: | ||
print "Unable to create data directory: " + newdir | ||
print "Error was: %s" % (sys.exc_info()[1],) | ||
print("Unable to create data directory: " + newdir) | ||
traceback.print_exc() | ||
exit(1) | ||
if not os.path.exists(newdir): # Make sure it's there now | ||
print "Unable to find or create data directory: " + newdir | ||
print("Unable to find or create data directory: " + newdir) | ||
exit(1) | ||
|
||
# Create database | ||
|
||
def create_database(): | ||
db.create_all() | ||
db.session.commit() | ||
|
||
# Find and add all of the ImageStatuses in models.py | ||
statuses = [s for s in dir(models) if s.startswith('IMAGESTATUS_')] | ||
for status in statuses: | ||
id = getattr(models, status) | ||
s = models.ImageStatus(id, status.split('_',1)[1]) | ||
db.session.add(s) | ||
|
||
# Find and add all of the ImageLevels in models.py | ||
levels = [l for l in dir(models) if l.startswith('IMAGELEVEL_')] | ||
for level in levels: | ||
id = getattr(models, level) | ||
l = models.ImageLevel(id, level.split('_',1)[1]) | ||
db.session.add(l) | ||
|
||
db.session.commit() | ||
|
||
|
||
if __name__ == '__main__': | ||
create_data_dirs() | ||
|
||
app = create_app() | ||
with app.app_context(): | ||
create_database() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.