Saturday, August 28, 2010

Django Application : Create blog

Django : A Simple Blog Example

  First Create application in Django project directory
#python manage.py startapp blog
 Edit your setting.py file and add appilcation code 
For example :-
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'mysite.blog',  
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
)
also add  Email host to send email.
by default its for locahost, but if your host have not configure EMAIL_HOST then you add this in settings.py 

#EMAIL_HOST = "hostname.com"

 Edit Urls in url.py main file in  project Directory.
Urls.py 
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^blog/', include('mysite.blog.urls')),
)

Saturday, August 14, 2010

Automation Project is approved : Sourceforge.org And Sarovar.org

Project registration for Automation has been approved.
Sarovar
links:-
http://sarovar.org/projects/automation/
http://automation.sarovar.org/
Sourceforge
links:-
http://automations.sourceforge.net/
http://sourceforge.net/projects/automations/

Tuesday, August 10, 2010

Check Django version

Start the interactive Python interpreter
>>> import django


>>> print django.VERSION

Monday, August 9, 2010

Batch resize/Compress all images in a folder.

Make a new file (not as root):
Run In Terminal
#gedit ~/.gnome2/nautilus-scripts/batch640x480

and then Add
#!/bin/sh 
# Use this script to batch resize all images in a folder. 
# First open the folder and then use the script.  
for file in `ls -l` 
do 
name=`echo $file | cut -f1 -d.`
convert -geometry 680x500 -quality 65 $file ${name}_680x500.jpg
done


Save this file and make this file executable:
#chmod +x ~/.gnome2/nautilus-scripts/batch640x480
Go to the folder you'd like to resize. Then rightclick and find the 'batch640x480' script.
I use this script for resizing large amounts of photo's for a website

Sunday, August 8, 2010

Drupal error : Function ereg() is deprecated

Its is very simple to solve
open file includes/file.inc in drupal directory
Goto line no in which this error is show


where you can see something like this
elseif ($depth >= $min_depth && ereg($mask, $file))
Now add @ sign before ereg($mask, $file)
copy below line past this line
elseif ($depth >= $min_depth && @ereg($mask, $file))

Its works

Thursday, August 5, 2010

Python : CMS

Plone

A powerful, flexible Content Management solution that is easy to install, use and extend

Plone lets non-technical people create and maintain information for a public website or an intranet using only a web browser. Plone is easy to understand and use — allowing users to be productive in just half an hour — yet offers a wealth of community-developed add-ons and extensibility to keep meeting your needs for years to come.

Click here for further detail

Skeletonz


Skeletonz is a new content management system (CMS) based on Python. It differs from others by being simple, but yet very powerful and extensible. If you need a simple system that you and your users are going love then Skeletonz might be the solution you are looking for! The system is open source and released under GNU GPL.

Click here for further detail

Wednesday, August 4, 2010

Django : Auto-Generate model.py file from PostgreSQL / MySQL / SQLite database

inspectdb

django-admin.py inspectdb
Introspects the database tables in the database pointed-to by the NAME setting and outputs a Django model module (a models.py file) to standard output.
This feature is meant as a shortcut, not as definitive model generation. After you run it, you'll want to look over the generated models yourself to make customizations. In particular, you'll need to rearrange models' order, so that models that refer to other models are ordered properly.
Primary keys are automatically introspected for PostgreSQL, MySQL and SQLite, in which case Django puts in the primary_key=True where needed.
inspectdb works with PostgreSQL, MySQL and SQLite. Foreign-key detection only works in PostgreSQL and with certain types of MySQL tables.
Example :
Use command
#python manage.py inspectdb >>Models.py
this will automatically convert the django database into Models.py file .