How to create a custom 404 page for my Django/Apache?
I know that you use .htaccess in the document-root directory in standard apache. What if I use Django? Can someone give me step by step how to create a custom 404 page? THanks. ...
I know that you use .htaccess in the document-root directory in standard apache. What if I use Django? Can someone give me step by step how to create a custom 404 page? THanks. ...
I have a Django project located at /var/django/project/ where /var/django/ is in the PATH within that project I have: ___init__.py manage.py utils/ __init__.py tools.py utils/__init__.py contains a function named get_preview utils/tools.py contains a function named get_related How can utils/__init__.py import get_related fr...
An ARC file is a lossless data-compression format. http://en.wikipedia.org/wiki/ARC%5F%28file%5Fformat%29 I've tried googling some, but the Python ARC readers are 404 errors, or cannot be found. Anyone know of any library I can use? ...
I'm trying to add slugs to the url in my django app, much like SO does. Currently, I have pages that work just fine with a url like this: http://example.com/foo/123/ I'd like to add 'slugified' urls like so: http://example.com/foo/123/foo-name-here I can get it to work just fine, by simply modifying the urlconf and adding a throwa...
Currently I have three URL paths that map to ServiceHandler. How do I combine the three into one neat regex that can pass n number of arguments to ServiceHandler? (r'/s/([^/]*)', ServiceHandler), (r'/s/([^/]*)/([^/]*)', ServiceHandler), (r'/s/([^/]*)/([^/]*)/([^/]*)', ServiceHandler) ...
There is a read-only library function that takes a file as an argument. But I have a string. How do I convert a string to a file, that if you read the file it will return this string? I don't want to write to disk. ...
I am trying to code a word descrambler like this one here and was wondering what algorithms I should use to implement this. Also, if anyone can find existing code for this that would be great as well. Basically the functionality is going to be like a boggle solver but without being a matrix, just searching for all word possibilities from...
The documentation says: http://docs.djangoproject.com/en/dev/ref/settings/#time-zone Note that this is the time zone to which Django will convert all dates/times -- not necessarily the timezone of the server. For example, one server may serve multiple Django-powered sites, each with a separate time-zone setting. Normal...
I want to create a user group using python on CentOS system. When I say 'using python' I mean I don't want to do something like os.system and give the unix command to create a new group. I would like to know if there is any python module that deals with this. Searching on the net did not reveal much about what I want, except for python ...
Hi, I downloaded the source. Untarred it. "sudo python setup.py install". And below are the errors I get. Can someone help? By the way, Numpy is installed. Thanks a lot. src/_image.cpp:5:17: error: png.h: No such file or directory src/_image.cpp: In member function 'Py::Object Image::write_png(const Py::Tuple&)': src/_image.cpp:646: ...
I have a file that contains two sequences. I have a program that could read all sequences, combine them together, and display the length of both sequences together. Now I want to display the length individually. The two sequences are separated by the symbol >. Example: SEQ1 >ATGGGACTAGCAGT SEQ2 >AGGATGATGAGTGA Program: #!usr/bin/...
Hello, I wrote a small python script for vim that uses the curses library. When I try to call the function curses complains about: Traceback (most recent call last): File "<string>", line 9, in <module> File "/usr/lib/python2.6/curses/__init__.py", line 33, in initscr fd=_sys.__stdout__.fileno()) _curses.error: setupterm: could not find...
Via fink install I put the following Python version on my Mac OS X computer: python2.3, python2.4, python2.5, python2.6. Further, python is alias for python2.6 on my system. I want to install an egg, e.g. easy_install networkx-0.36-py2.5.egg, where I have to use python 2.5 instead of version 2.6. Is this possible without changing t...
I'm using Boost.Python to create Python modules from C++ classes. And I ran into a problem with references. Condider the following case where I have a class Foo with overloaded get methods that can either return by value or reference. Specifying that the return by value should be used was easy once I typedefed a signature. But I think ...
I am working on power monitoring and want to send live power data to authorised users only. Some users have opted to install power sensors in their houses, others are viewing those sensors. Each sensor sends samples to a Twisted backend - the goal is to have this backend forward the data to Javascript running in the browser. My current ...
I have a a date in strptime that I want to show as 'X hours ago'. I can happily convert hours into days and weeks etc. but I don't know how to do the initial sum. Here is how I'm converting the string into strptime: time.strptime(obj.created_at, '%a %b %d %H:%M:%S +0000 %Y') p.s. bonus points for figuring out why it won't take %z for ...
I'm using (and enjoying) the Leo literate text editor, but I'm having a problem with one area of configuration. I like working with a black background and have changed the colours in LeoSettings.leo appropriately, but all but the last opening bracket on a line are displaying in black. Are there any known workarounds to this bug (I'm us...
Is is possible to do something similar to this with a list, dictionary or something else even? data_dict = { 'title' : 'awesome title', 'body' : 'great body of text', } Model.objects.create(data_dict) Even better if I can extend it Model.objects.create(data_dict, extra='hello', extra2='world) ...
Standard libraries (xmlrpclib+SimpleXMLRPCServer in Python 2 and xmlrpc.server in Python 3) report all errors (including usage errors) as python exceptions which is not suitable for public services: exception strings are often not easy understandable without python knowledge and might expose some sensitive information. It's not hard to f...
I am trying to iterate through a list and take each part of the list, encode it and join the result up when it is all done. As an example, I have a string which produces a list with each element being 16 characters in length. message = (u'sixteen-letters.sixteen-letters.sixteen-letters.sixteen-letters.') result = split16(message, 16) m...