Showing posts with label development server. Show all posts
Showing posts with label development server. Show all posts

Sunday, April 29, 2012

Learning Python

So far so good! I have now managed to create my 1st webapp following the HF Python book, and one neat feature to know (though I come from a Django background, is the use of the CGI debugger feature!

If your like me, learning the ins and outs of the Python foundation, this will allow you to get more information on the standard error, streamed at the browser, for debugging purposes (HF Python, page 248). Add the following two lines of code to your main webapp script and let Python take care of showing you the details of the errors it has found:



import cgitb
cgitb.enable()

So now we go on to Python for Android and I'm sure you will like these two links:

Wednesday, March 19, 2008

Django Development Server Style Sheet Configuration

When using style sheets (css), specially when using the Django development server, some adaptations are needed in get both the style sheets and the images served. For this, we need use the media path as defined for the framework.

settings.py
First the media path must be defined and must differentiate it self:

MEDIA_ROOT = '/path/to/media/'
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/amedia/'

urls.py
Now we add/link the path to the media path itself:

if settings.DEBUG:
urlpatterns += patterns('', (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root':'/home/fbenavides/Documents/workspace3dot3/txm/src/txm/media/', 'show_indexes': True}), )

index.html
In the given HTML file header (index.html is just an example file), the style sheet link must be added:

<link href="/media/css/bluebusiness.css" rel="stylesheet" type="text/css" />

It is assumed that the media path is as follows:

/media/
/media/css/
/media/images/

Thus when calling other style sheets and/or images, these must follow the proper call path.