import web_pdb;
class SipNoteUpdateView(LoginRequiredMixin, UpdateView):
model = SipNote
fields = ['note', 'note_date', 'at_devices', 'independent_living', 'orientation', 'communications', 'dls',
'support', 'advocacy', 'counseling', 'information', 'services', 'retreat', 'in_home', 'seminar',
'modesto', 'group', 'community', 'class_hours', 'sip_plan', 'instructor']
template_name_suffix = '_edit'
def dispatch(self, request, *args, **kwargs):
# web_pdb.set_trace() # Add this line to trigger the debugger
return super().dispatch(request, *args, **kwargs)
def get(self, request, *args, **kwargs):
# web_pdb.set_trace() # Add this line to trigger the debugger
return super().get(request, *args, **kwargs)
PROD:
pg_dump --exclude-table="account_*" $(get_db_settings 'NAME') > dump.sql
(Why the --exclude
flag? See README's TODOs about django-user-accounts
.)
DEV:
scp
thedump.sql
file from PROD to DEVjust db
just c -f dump.sql
just c --command="ANALYZE"
just deps
just m migrate
(orjust m migrate --fake-initial
)just prep
just serve
One-liner:
just db && just c -f dump.sql && just c --command="ANALYZE" && just deps && just migrate && just prep && just serve
Serving with gunicorn:
just gunicorn 8000
Use --reload
when developing:
just gunicorn 8000 --reload
# /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
# /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/lynx/slate-2/lynx
ExecStart=/home/mjtolentino/.local/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
--log-level debug \
mysite.wsgi:application
[Install]
WantedBy=multi-user.target