4. February 2013

Useful Django package: django-debug-toolbar

django-debug-toolbar is simply must have tool for Django development.

It adds powerfull toolbar which allows detailed diagnostic and debugging of Django site.

django-debug-toolbarQuick install:

pip install django-debug-toolbar

Open settings.py and add:

MIDDLEWARE_CLASSES = (
    # ...
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    # ...
)
INTERNAL_IPS = ('127.0.0.1',)
INSTALLED_APPS = (
    ...
    'debug_toolbar',
)

Make sure that DEBUG is set to True

DEBUG = True

26. August 2012

WebExpo Startup Camp – summer 2012 – materials

I’m glad that I had opportunity to join Startup Camp in Trhový Štěpánov as mentor. Together with startup teams we were discussing and preparing new sites for their products. People were learning how to use Git, how to program in Python and how to create sites in Django. At the end of the day they were able to create prototype or deploy it to Heroku cloud.

Yyou can find my slides at SlideShare or download it as PDF.

Examples of Python code and simple Django testing project are available at GitHub in repository try_git.

Read more about WebExpo Startup camp.

20. August 2012

Problems with deploying Heroku Django app from Windows

Deploying Django app to Heroku from Windows machine is little bit tricky.

You can follow instructions in Heroku manual. The first problem that you may encounter is with Postgres support in Python. There is problem with this command:

pip install Django psycopg2 dj-database-url

If you do not have Visual Studio installed on your machine, you’ll receive error that vcvarsall.bat is missing.

Solution is quite easy. You don’t need to install Visaul Studio. Just download binary version of psycopg2 module from http://www.stickpeople.com/projects/python/win-psycopg/

Then you can exclude psycopg2 from pip install command, because it is installed in system directory of Python.

Another tricky issue is with command:

pip freeze >requirements.txt

If you type this command in PowerShell then it will automatically create Unicode file with extra bytes. When you try to deploy project with messed requirements.txt to Herou then you’ll see self explanatory error 😉

TypeError: must be encoded string without NULL bytes, not str

Nice 🙂

Just open requirements.txt file with notepad and select Save as. In Save as dialog choose ANSI.

Commit file and push project to Heroku. It will work 😉

  • Where is the fish?

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics