Fix deploying with gunicorn.

This commit is contained in:
Michael Zhang 2016-03-16 20:41:05 -05:00
parent a6566d3fce
commit bb4d106130
7 changed files with 14 additions and 6 deletions

4
Vagrantfile vendored
View file

@ -19,4 +19,8 @@ Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end

0
deploy Executable file → Normal file
View file

View file

@ -5,5 +5,5 @@ SQLAlchemy
gunicorn
requests
voluptuous
PIL
Pillow
markdown2

0
scripts/setup.sh Executable file → Normal file
View file

View file

@ -5,5 +5,4 @@ import problem
import user
import stats
import team
import tools
import utils

View file

@ -18,6 +18,8 @@ app.config.from_object(config)
if not os.path.exists(app.config["UPLOAD_FOLDER"]):
os.makedirs(app.config["UPLOAD_FOLDER"])
if not os.path.exists("pfp"):
os.makedirs("pfp")
with app.app_context():
from api.models import db, Files, Teams, Problems, Solves, Users
@ -44,10 +46,12 @@ def api_main():
def page_not_found(e):
return send_file("../web/index.html")
def run(args):
def run(args=None):
with app.app_context():
try:
keyword_args = dict(args._get_kwargs())
app.debug = keyword_args["debug"] if "debug" in keyword_args else False
except: pass
app.run(host="0.0.0.0", port=8000)
def load_problems(args):
@ -112,4 +116,5 @@ def main():
else:
parser.print_help()
if __name__ == "__main__":
main()

0
web/includes/meta.html Executable file → Normal file
View file