Sunday, December 15, 2013

Django Logging Tutorial
1.Update LOGGING section in settings.py with logger,handler,formatter fields
  Logger which specifies the handler, in this case it is file
 'loggers': {
        'logapp':{
            'handlers': ['file'],
            'level': 'DEBUG',
        },
    }
  File handler specifies the filename "logapp.log", also specifies theformatter in this case it is simple.
  'handlers': {
        'file':{
            'level':'DEBUG',
            'class':'logging.FileHandler',
            'filename':'logapp.log',
            'formatter':'simple'
        },
    }
  Formatter specifies the formatter in this case it is 'simple'.
 'formatters':{
        'simple':{
           'format':'%(levelname)s %(message)s'
        }
    },
2. import logging modules and add the logger message lines whereever it is required to have log message.

    logger.debug("This is debug message")
    logger.error("This is error message")

3. log messages will be printed in the log file in this case "logapp.log"
   http://127.0.0.1:8000/logproject/

4.Source Code can be downloaded from the github
https://github.com/Jadatravu/Tutorials/tree/master/django_tutorials/logproject

Note: This tutorial is compatible with django 1.5.4, python 2.7.4

Tuesday, December 3, 2013

Django Helloworld tutorial
1. Install django from pip or apt-get/yum 2. Install mysql, python-mysqldb pacakge from apt-get/yum 3. Create database in mysql using steps mentioned in the url creating-database 4. Creating mysql user and granting database permissions to the created user using the steps mentioned in the url adding-users 5. Edit helloworld/settings.py for database settings [ Database(mysql), Database name, Database user, Database user password] 6. Run server in the helloworld directory python manage.py runserver
7. Open the url http:/127.0.0.1:8000/helloworld


8.Source Code can be downloaded from the github
https://github.com/Jadatravu/Tutorials/tree/master/django_tutorials/helloworld
Note: This tutorial is compatible with django 1.5.4, python 2.7.4

Monday, November 4, 2013

Deploying Django application. http://tinyurl.com/odz9hfx

1. Install libapache2-mod-wsgi using apt-get utility.

2. Add below lines to /etc/conf/apache2.conf

WSGIScriptAlias / /home/notroot/django_tut/helloworld/helloworld/wsgi.py
WSGIPythonPath /home/notroot/django_tut/helloworld/
<Directory /home/notroot/django_tut/helloworld/>
<Files wsgi.py>
Order deny,allow
Require all granted
Satisfy Any
</Files>
</Directory>

3. reload apache2 "service apache2 reload"

4. access url/view from the browser example : http://127.0.0.1/helloworld

Saturday, November 2, 2013

Database relationships are very well explained. http://tinyurl.com/yktcdlm
  • One to One Relationships
  • One to Many and Many to One Relationships
  • Many to Many Relationships
  • Self Referencing Relationships

Thursday, October 24, 2013

Radi-testdir release:

In this release RPM package to install packages in RPM based distributions is made. This make radi-testdir to be install able in RPM based Linux distributions also.