Closed mattben closed 9 years ago
@mattben I don't have access to prod. I'll list what I had to do to fix dev.
git pull
source env/bin/activate
pip install -U -r requirements.txt
find . -iname "*.pyc" -delete
./manage.py migrate --fake-initial
Then we have to edit local_settings.py, remove STATICFILES_DIRS, and set STATIC_ROOT to something reasonable ("/var/www/static", for example).
You'll then have to run:
./manage.py collectstatic
Once that's done, we need to let apache know it's supposed to serve the static files...
In the virtualhost for the app, add this (at some point before the ProxyPass statement):
Alias /static/ /var/www/static/ # or whatever you set STATIC_ROOT to
<Directory /var/www/static>
Order allow,deny
Allow from all
</Directory>
Basically the same, with some minor tweaks. In particular: the permissions grant syntax was changed, and for some reason, the default ProxyPass
we had set up (ProxyPass / uwsgi://...
) was absorbing all paths, including the aliased /static/ above it. This meant that Django was being asked to serve static files, which was, in fact, the entire reason I changed how static files were served. You have to wrap the ProxyPass
with a LocationMatch
tag, which lets you use regex to determine what path to match on, and then use a regex with a negative lookahead (?!/static)
to skip the static path.
Alias /static/ /var/www/static/ # or whatever you set STATIC_ROOT to
<Directory /var/www/static>
Require all granted
</Directory>
<LocationMatch "^(?!/static)">
ProxyPass uwsgi://127.0.0.1:UWSGI_PORT_NUMBER/
</LocationMatch>
I was running into some issues with the app not being able to find the WSGI callable module, which makes sense, because I eliminated apps/__init__.py
during the upgrade to Django 1.8 (it was causing some issues with the models). In order to properly contact the application, you're going to have to hack the Python module loading system by adding $INSTALL_LOCATION/apps
to $PYTHONPATH
, which you do by adding this line to the end of acme-web-fe.uwsgi:
env=PYTHONPATH=/var/www/acme-web-fe/apps ; or whatever path is correct for your installation
Now restart uwsgi (service uwsgi restart
) and apache. If you're still having issues with the old app being served, I had to do service uwsgi stop
twice in order to actually make it work for realsies.
devel is back up, btw.
@chaosphere2112 Thank you. I have to do prod now correct?
Yup
just notes for the future
yum install ncurses-devel ncurses-libs ncurses-static
local_settings
STATIC_ROOT = "/var/www/acme-static"
STATIC_URL = '/static/'
esgf service node manager is down atm. but the site is up and running in prod now.
Prod and Dev are both broke from the Django upgrade, please fix both servers.