Posts

Showing posts with the label django

Deploying Django Applications to Apache HTTP Server (mod_python)

Official Documentation Assumptions: Python and Django are already installed. You already developed a new application and would like to deploy it on Apache. 1. Install Apache HTTP Server       (i.e. yum install httpd) 2. Install Apache Python Module (mod_python)      (i.e. yum install mod_python) 3. Configure Apache by editing python.conf (located under <Apache_HTTP_Server_Install_ROOT>/conf.d/. On linux in the /etc directory: /etc/httpd/conf.d/python.conf). Replace below <APPLICATION_NAME> with the name of your application located under the project directory. <Location "/<APPLICATION_NAME>">     SetHandler python-program     PythonHandler django.core.handlers.modpython     SetEnv DJANGO_SETTINGS_MODULE <APPLICATION_NAME>.settings     PythonPath "['<PATH_TO_DIR_CONTAINING_YOUR_APPLICATION>'] + sys.path"     PythonDebug...

Django (1.2.3) CRUD Using Generic Views

Image
Django CRUD using Generic Views for Django 1.2.3 An adaptation after the How to use generic views in Django Please visit Django project website for more information: DJANGO MODELS (models.py) from django.db import models from django.forms import ModelForm import datetime # Create your models here. class Task(models.Model): priority = models.CharField(max_length=100) task = models.CharField(max_length=500) description = models.CharField(max_length=1000) owner = models.CharField(max_length=100) status = models.CharField(max_length=100) entry_date = models.DateTimeField(editable=False) def __unicode__(self): return self.task def save(self): self.entry_date = datetime.datetime.now() super(Task, self).save() @models.permalink def get_absolute_url(self): return ('task-display', (), {'object_id': self.id}) class TaskForm(ModelForm): class Meta: model = Task URls (urls.py) from django.conf.urls.defaults import * from django.views.generic import li...