Skip to content

Commit

Permalink
Updates for python3 based deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Jan 12, 2020
1 parent 41365a4 commit 381b667
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/puzzlehunt_generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NameVirtualHost *:80
ProxyPass /static/ !
ProxyPass /media/ !

WSGIDaemonProcess puzzlehunt_server python-path=${basepath}:${basepath}/venv/lib/python2.7/site-packages
WSGIDaemonProcess puzzlehunt_server python-path=${basepath}:${basepath}/venv/lib/python3.5/site-packages
WSGIProcessGroup puzzlehunt_server
WSGIScriptAlias / ${basepath}/puzzlehunt_server/wsgi.py

Expand Down
17 changes: 9 additions & 8 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}



# ===== Program setup (Overriding Fabric to use host files) =====
class PuzzlehuntManager(Fab):
# Adds in my opinions (run:echo=True) and the settings from the hosts files
Expand Down Expand Up @@ -89,7 +90,7 @@ def parameterize(self, call, connection_init_kwargs):

# ===== Private helper functions =====
def test(ctx):
return ctx.run("./venv/bin/python manage.py test --noinput")
return ctx.run("./venv/bin/python3 manage.py test --noinput")

# ===== Public routines =====
@task
Expand Down Expand Up @@ -143,11 +144,11 @@ def deploy(ctx, initial=False):
ctx.run('git checkout {}'.format(ctx.config.host.branch))
ctx.run("virtualenv venv")
with ctx.prefix("source venv/bin/activate"):
ctx.run('pip install -r requirements.txt')
ctx.run('python manage.py migrate')
ctx.run('python manage.py collectstatic --noinput')
ctx.run('pip3 install -r requirements.txt')
ctx.run('python3 manage.py migrate')
ctx.run('python3 manage.py collectstatic --noinput')
if(initial):
ctx.run('python manage.py loaddata initial_hunt')
ctx.run('python3 manage.py loaddata initial_hunt')

ctx.run('mkdir -p ./media/puzzles')
ctx.run('mkdir -p ./media/prepuzzles')
Expand Down Expand Up @@ -193,11 +194,11 @@ def install(ctx):
ctx.sudo("service mariadb restart")

# Install python related
ctx.sudo('apt-get install -y python-dev python-mysqldb python-pip')
ctx.sudo('pip install virtualenv')
ctx.sudo('apt-get install -y python3-dev python3-mysqldb python3-pip')
ctx.sudo('pip3 install virtualenv')

# Install apache and related
ctx.sudo('apt-get install -y apache2 libapache2-mod-xsendfile libapache2-mod-wsgi')
ctx.sudo('apt-get install -y apache2 libapache2-mod-xsendfile libapache2-mod-wsgi-py3')
# Apache hosting setup
ctx.sudo('a2enmod proxy')
ctx.sudo('a2enmod proxy_http')
Expand Down
2 changes: 1 addition & 1 deletion huntserver/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class TeamAdmin(admin.ModelAdmin):


class PersonAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'is_shib_acct',)
list_display = ('__str__', 'is_shib_acct',)
search_fields = ['user__email', 'user__username', 'user__first_name', 'user__last_name']


Expand Down

0 comments on commit 381b667

Please sign in to comment.