background preloader

Writing your first Django app, part 1

Writing your first Django app, part 1
Let’s learn by example. Throughout this tutorial, we’ll walk you through the creation of a basic poll application. It’ll consist of two parts: A public site that lets people view polls and vote in them.An admin site that lets you add, change, and delete polls. We’ll assume you have Django installed already. $ python -c "import django; print(django.get_version())" If Django is installed, you should see the version of your installation. This tutorial is written for Django 1.9 and Python 3.4 or later. See How to install Django for advice on how to remove older versions of Django and install a newer one. Where to get help: If you’re having trouble going through this tutorial, please post a message to django-users or drop by #django on irc.freenode.net to chat with other Django users who might be able to help. Creating a project¶ If this is your first time using Django, you’ll have to take care of some initial setup. $ django-admin startproject mysite Note Where should this code live? These files are: Related:  Django

Current Django Books – Two Scoops Press This page is a complete list of Django web framework published books that are current, deprecated, and outdated. This is a listing of all Django books, not just selected ones that we recommend. By books, we mean complete, published reference works available in print with an ISBN. Links lead to Amazon, but are "internationalized", meaning US readers go to amazon.com, UK readers go to amazon.co.uk, and so forth. Out of these 26 published references, 42.30769230769231% are for supported versions of Django. Current (Django 1.9, 1.8) - 11 books Outdated (Django 1.7 or lower) - 15 books Listed here for historical reference only.

PostgreSQL + Python | Psycopg psycopg Psycopg is the most popular PostgreSQL adapter for the Python programming language. At its core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL. Psycopg is released under the terms of the GNU Lesser General Public License, allowing use from both free and proprietary software. Latest articles Psycopg 2.6.1 released Posted by Daniele Varrazzo on June 16, 2015 Tagged as news, release Psycopg 2.6 and 2.5.5 released Posted by Daniele Varrazzo on February 9, 2015 Psycopg 2.5.4 released Posted by Daniele Varrazzo on August 30, 2014 Tagged as news, release Cancelling PostgreSQL statements from Python Posted by Daniele Varrazzo on July 20, 2014 Tagged as recipe Psycopg 2.5.3 Released Posted by Daniele Varrazzo on May 13, 2014 Tagged as news, release Donate Quick links Tweets JSON adapter, PG 9.2 range support, context manager, error diagnostics, better composite types... only in Psycopg 2.5!

jgorset/django-kronos Django - Full Stack Python Django is a widely-used Python web application framework with a "batteries-included" philosophy. The principle behind batteries-included is that the common functionality for building web applications should come with the framework instead of as separate libraries. For example, authentication, URL routing, a templating system, an object-relational mapper (ORM), and database schema migrations (as of version 1.7) are all included with the Django framework. Compare that included functionality to the Flask framework which requires a separate library such as Flask-Login to perform user authentication. The batteries-included and extensibility philosophies are simply two different ways to tackle framework building. Neither philosophy is inherently better than the other one. Why is Django a good web framework choice? The Django project's stability, performance and community have grown tremendously over the past decade since the framework's creation. Django books and tutorials Django videos

Psycopg – PostgreSQL database adapter for Python — Psycopg v2.4.5 documentation Psycopg is the most popular PostgreSQL database adapter for the Python programming language. Its main features are the complete implementation of the Python DB API 2.0 specification and the thread safety (several threads can share the same connection). It was designed for heavily multi-threaded applications that create and destroy lots of cursors and make a large number of concurrent INSERTs or UPDATEs. Psycopg 2 is mostly implemented in C as a libpq wrapper, resulting in being both efficient and secure. Psycopg 2 is both Unicode and Python 3 friendly. Contents Indices and tables

33 projects that make developing django apps awesome — elweb There are many reasons why I like developing web applications with Python and Django but the main one is the awesome community and projects around the language and framework. Every time I search for something there’s always a Django or Python project available to make my life easier. Here’s an incomplete list of Python and django related projects that I have used or I’m planning to test. Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel’s content. South South brings migrations to Django applications. Django Paypal Django PayPal is a pluggable application that implements with PayPal Payments Standard and Payments Pro. Fab Shameless plug.

Simplifying Django The following comes to you from Julia Elman and Mark Lavin. Julia is a a hybrid designer/developer who has been working her brand of web skills since 2002; and Mark is the Development Director at Caktus Consulting Group in Carrboro, NC where he builds scalable web applications with Django. Together, they are working on Lightweight Django, a book due out later this year that explores bringing Django into modern web practices. Despite Django’s popularity and maturity, some developers believe that it is an outdated web framework made primarily for “content-heavy” applications. Since the majority of modern web applications and services tend not to be rich in their content, this reputation leaves Django seeming like a less than optimal choice as a web framework. Let’s take a moment to look at Django from the ground up and get a better idea of where the framework stands in today’s web development practices. Plain and Simple Django Onboarding New Django Users Simple, right?

How to create a basic blog in Django » Defining your models | djangorocks.com The model is your database structure. Lets start by opening the models.py file, and start adding some fields. Because I am keeping this simple, I will not be including users at this stage. class Blog(models.Model): title = models.CharField(max_length=100, unique=True) slug = models.SlugField(max_length=100, unique=True) body = models.TextField() posted = models.DateField(db_index=True, auto_now_add=True) category = models.ForeignKey('blog.Category') class Category(models.Model): title = models.CharField(max_length=100, db_index=True) slug = models.SlugField(max_length=100, db_index=True) Now lets see what each part means. This creates a database table with the name "Blog". class Blog(models.Model): These are basic fields to be created in your database title = models.CharField(max_length=100, db_index=True) slug = models.SlugField(max_length=100, db_index=True) body = models.TextField() posted = models.DateTimeField(db_index=True, auto_now_add=True) The last field, a little more advanced.

Servers — Django Best Practices Note Deployment arcitectures vary widely depending on the needs and traffic of the site. The setup described below is minimally configured and works well for most instances. We serve Django on Ubuntu Linux with a PostgreSQL database backend via gunicorn or uWSGI from behind an Nginx frontend proxy. Nginx Nginx makes for a great frontend server due to its speed, stability and low resource footprint. What Does it Do? The first block tells Nginx where to find the server hosting our Django site. Another benefit to running a frontend server is SSL termination. You can include this code at the bottom of your non-SSL configuration file. Gunicorn Gunicorn is a lightweight WSGI server that can scale from small deploys to high-traffic sites. $ gunicorn --workers=4 --bind=127.0.0.1:9000 my_project.wsgi:application This spawns a gunicorn process with 4 workers listening on Process Management Save this file to /etc/init/gunicorn.conf and run sudo start gunicorn.

Twilio Cloud Communications - APIs for Voice, VoIP, and Text Messaging How It Works Ready to implement appointment reminders in your application? Here's how it works at a high level: An administrator (our user) creates an appointment for a future date and time, and stores a customer's phone number in the database for that appointmentWhen that appointment is saved a background task is scheduled to send a reminder to that customer before their appointment startsAt a configured time in advance of the appointment, the background task sends an SMS reminder to the customer to remind them of their appointment Building Blocks Here are the technologies we'll use: Django to create a database-driven web applicationThe Messages Resource from Twilio's REST API to send text messagesCelery to help us schedule and execute background tasks on a recurring basis How To Read This Tutorial To implement appointment reminders, we will be working through a series of user stories that describe how to fully implement appointment reminders in a web application. Let's get started! Finished

Effective Django — Effective Django Coding for Entrepreneurs Projects Step-by-step to learn and launch your web project. Try Django 1.9 Free Preview Try Django 1.9 is an introduction to Django version 1.9 by creating a simple, yet robust, Django blog. This series co... View » Code Related: Python Django Bootstrap (framework) Django 1.9 Blog Try Django 1.8 Free Preview The Try Django series has been developed to indroduce Django to new developers. View » Code Related: Django 1.8 Python Django Bootstrap (framework) Going Live Production eCommerce 2 77 lectures A step-by-step guide to creating your own custom eCommerce site using Django (v. 1.8), Bootstrap (v. 3.3), AJAX, jQue... View » Code Related: Django 1.8 Python Django Bootstrap (framework) Launch with Code Free Preview Create a social launching campaign using Django & Bootstrap with (basic hosting is free). View » Code Related: Python Django Bootstrap (framework) Going Live Production Srvup Membership 94 lectures View » Code Matchmaker 2 71 lectures View » Code View » View » Code View »

Related: