How to deploy a Django app on Heroku. Part II

This is the second part of a series on how to deploy a Django app on Heroku. If you haven’t looked at the first part, you might want to do it now. Go to How to deploy a Django app on Heroku. Part I.

You will see that the main idea behind these posts is not to build a functional Django app. Instead, what I want to do is to give you a bunch of good practices on how to build a Django app with different environments for testing, developing and production, useful packages installed, Internationalization and Localization properly configured, PosgreSQL installed, and much more.

PART II

The topics covered here are:

  • set different settings.py files for development, production and testing
  • save all the templates of your app in the same location
  • set debug false in production
  • install HTML5 Boilerplate
Google+TwitterLinkedInFacebookReddit

How to deploy a Django app on Heroku. Part I

This post is the first post of a series on how to deploy a Django project on Heroku.

You will see that the main idea behind these posts is not to build a functional Django app. Instead, what I want to do is to give you a bunch of good practices on how to build a Django app with different environments for testing, developing and production, useful packages installed, Internationalization and Localization properly configured, PosgreSQL installed, and much more.

PART I

This post explains how to create a Django project on Heroku. For this first part, I followed the tutorial Django on Heroku, and some ideas from the deploydjango website.

The topics covered here are:

  • set up Heroku
  • set up PostgreSQL
  • start a Django app in a Virtualenv
  • set the Procfile
  • specify the dependencies
  • separate your applications and your libraries
  • set the settings.py file
  • push your app in Heroku
  • change the name of your app

Read More!

Google+TwitterLinkedInFacebookReddit

Python scripts for prime numbers and divisors

Very recently I been interested in solving the problems proposed by Project Euler. Currently I just solved about 20 problems, but I run into some nice algorithms for finding prime numbers and divisors that I would like to share.

This first snippet defines a Python function that returns a list of the prime numbers up to a given integer. It uses the Sieve of Atkin, which is a modern algorithm that optimizes the Sieve of Eratosthenes.

Read More!

Google+TwitterLinkedInFacebookReddit