This commit is contained in:
Michael Zhang 2015-12-25 23:48:20 -06:00
parent b7d4196e1b
commit e3b20830b5
3 changed files with 54 additions and 48 deletions

View file

@ -11,6 +11,8 @@ server {
# location / { # location / {
# try_files $uri $uri/ =404; # try_files $uri $uri/ =404;
# } # }
# Put all the pages here so Angular doesn't fail.
location ~^/(about|login|register)$ { location ~^/(about|login|register)$ {
default_type text/html; default_type text/html;
try_files /index.html /index.html; try_files /index.html /index.html;

3
deploy
View file

@ -3,8 +3,9 @@
echo "Stopping the server..." echo "Stopping the server..."
pkill gunicorn pkill gunicorn
sudo service nginx stop sudo service nginx stop
tmux kill-session -t ctf
echo "Starting the server..." echo "Starting the server..."
cd /home/vagrant/server cd /home/vagrant/server
sudo service nginx start sudo service nginx start
gunicorn "app:app" -c /home/vagrant/scripts/gunicorn.py.ini tmux new-session -s ctf -d 'gunicorn "app:app" -c /home/vagrant/scripts/gunicorn.py.ini'

View file

@ -4,6 +4,7 @@ from flask import current_app as app
from models import db, Users from models import db, Users
from utils import api_wrapper from utils import api_wrapper
import logging
import requests import requests
import utils import utils
@ -38,6 +39,8 @@ def user_register():
return { "success": 0, "message": "Email has already been used." } return { "success": 0, "message": "Email has already been used." }
add_user(name, username, email, password) add_user(name, username, email, password)
logger = logging.getLogger("regs")
logger.warn("[{0}] {1} registered with {2}".format(time.strftime("%m/%d/%Y %X"), name.encode("utf-8"), email.encode("utf-8")))
return { "success": 1, "message": "Success!" } return { "success": 1, "message": "Success!" }