Dad is a good guy. But he ain’t like virtualenv -p $(pyenv which python3) .venv, then pip install -r requirements.txt? NP, SON! He’s more like When I double click the python file, cmd flashes and I bluescreen. So he needs an exe file. Here’s a general snippet for converting python3 to exe

Sending SMS using twilio.com is nice, but it also costs money. If you want something free that you can use for your hobby projects, check out pushbullet.com. If you sign up (it’s free), you can push SMS with the following: Sign up at pushbullet.com Get the app Install pushbullet with pip: pip install pushbullet.py Find your API key here…

Case: You want efficient collectstatic and serving of files You want static files and media files to be hosted on an AWS S3 bucket. (optional) You have too many files for “normal” collectstatic to be efficient. (optional) You have a non-US S3 bucket. (optional) You use Heroku Disclaimer: Have not tested with python 2.7, can’t…

I changed the MEDIA_URL and STATIC_URL, but wanted the previously used urls “/media/” and “/static/” to rewrite to the new url. It would better be done via your DNS settings, or with an .htaccess file, but can also be done via urls.py if your circumstances don’t allow the other two. from django.conf import settings from django.views.generic.base import RedirectView […] if settings.MEDIA_URL…

I was looking for WEB_CONCURRENCY environment variable on my Django-app. This is used for the number of concurrent webworkers for gunicorn, and is automatically scaled depending on the memory usage of your app. Do it with the toolbelt, and command heroku run printenv –app your-app-name | grep WEB_CONCURRENCY Read more on optimizing your app here

Sometimes I clone a repository with Django and make a setup of the environment on my own machine. Then I would usually like to have some testdata populated in my environment. So here’s how to copy the data from one Django installation (production) to my environment (test). 1. ssh to the remote server ssh username@hostname 2. Navigate to the folder…

It has happened on more than one occasion that I want a new Django project, with Grunt, jQuery, Bootstrap, Font-Awesome etc, deployed on Heroku. So I decided to write down the steps, and made a bash script to automate it all for me.

Case: You’re using virtualenv and have used apache with a config somewhat like this. Problem: Apache ‘goes to sleep’ Apache caches your wsgi application, and if it’s not used within a certain amount of time, it has to reload. And this takes like.. 10-15 seconds. Solution: Use nginx instead: Set up a custom application, and install nginx + uwsgi to point to…

TLDR: Try sudo apt-get install python-dev sudo apt-get install libsqlite3-dev And recompile python (see own post) Long version So, I was starting a django app (1.7.1 with Python 3.4), python manage.py migrate when i encountered django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named ‘_sqlite3’ Did not expect this. I have…

Getting pip3.4 to work Want Python3.4 on your debian with virtualenv and pip? That’s what I wanted. However, I didn’t get pip automatically, and when I tried to install it, python gave me “Can’t decompress data; zlib not available” Spent a whole lot of time on this. Seems like installing 3.4 properly (with –with-zlib parameter when configuring) makes…