TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| class LoginRequiredMixin(object): | |
| """ | |
| View mixin which requires that the user is authenticated. | |
| """ | |
| @method_decorator(login_required) | |
| def dispatch(self, request, *args, **kwargs): | |
| return super(LoginRequiredMixin, self).dispatch( | |
| self, request, *args, **kwargs) |
| [program:myapp] | |
| autostart = true | |
| autorestart = true | |
| command = python /home/pi/myapp.py | |
| environment=SECRET_ID="secret_id",SECRET_KEY="secret_key_avoiding_%_chars" | |
| stdout_logfile = /home/pi/stdout.log | |
| stderr_logfile = /home/pi/stderr.log | |
| startretries = 3 | |
| user = pi |
| First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py | |
| $ cd <download location> | |
| $ sudo -H python ./get-pip.py | |
| Installing pip also installs Python3 | |
| To run Python3 | |
| $ python3 | |
| Install pip3 by just executing the same file as in the step above, but this time using Python3 | |
| $ sudo -H python3 ./get-pip.py |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| Versions: | |
| python : 2.7.1 | |
| openpyxl : 2.2.5 | |
| pyexcelerate: 0.6.6 | |
| xlsxwriter : 0.7.3 | |
| xlwt : 1.0.0 | |
| Dimensions: | |
| Rows = 10000 |
| #!/usr/bin/env python | |
| ''' | |
| This script will attempt to open your webbrowser, | |
| perform OAuth 2.0 authentication and print your access token. | |
| To install dependencies from PyPI: | |
| $ pip install oauth2client | |
| Then run this script: |
| ====================================== | |
| Setting up Nginx, uWSGI and Python3 | |
| ====================================== | |
| First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
| 1) Only showed you how to run the server for a single web application. | |
| 2) Only showed you how to configure the app, not the server it was running on. | |
| My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |