 |
|
 |
So, a while ago I wrote here about starting to experiment with Django, and now I have come to a stop...
I usually map my Django projects on the root, but this time I tried something different and failed very badly...
I tried to map it to http://foo.com/django and encountered two problems, I hope you guys can help me with...
Problem 1:
If I go to address http://foo.com/django (without trailing slash) I get an Internal Server Error.
Log shows this info:
File "/var/lib/python-support/python2.5/django/middleware/common.py", line 41, in process_request
if settings.APPEND_SLASH and (old_url1-1 != '/') and ('.' not in old_url1.split('/')-1):
IndexError: string index out of range
If I include the trailing slash it works (at least it seems to).
APPEND_SLASH is (obviously) set to True.
Problem 2:
Let's go with urls.py that looks like this:
from django.conf.urls.defaults import *
from djangobook.views import hello
urlpatterns = patterns('',
(r'^hello/$', hello),
)
Instead of going to http://foo.com/django/hello I get redirected to http://foo.com/hello. I presume I'm missing a setting or something to make it relative to the project's starting URL?
We are using Linux daily to UP our productivity - so UP yours!
|
|
|
|
 |
|
 |
When you deploy on a subdirectory you will need to make sure you account for that in your url patterns. Take a look here.[^]
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov
Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
|
|
|
|
 |
|
 |
So, all the url patterns have to start with '/django/ ' ?
Besides, there are no instructions for mod_wsgi, or I can't see them?
We are using Linux daily to UP our productivity - so UP yours!
|
|
|
|
 |
|
 |
You shouldn't need to make any mod_wsgi changes. And don't copy the apache config on the link, it looks like it would kill you app since it seems to be a mod_python set-up. So, try to leave you apache config alone and start with your patterns.
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov
Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
|
|
|
|
 |
|
 |
Ok, so what I just figured is that I get redirected from foo.com/django/hello to coo.com/hello only if I leave the trailing slash.
How can I make django append the trailing slash in the URL? APPEND_SLASH is set to true.
We are using Linux daily to UP our productivity - so UP yours!
|
|
|
|
 |
|
 |
Hi there!
Need your help with:
Bigram probality of a sentence structure.
We can talk more if anyone email me back.
Best regards,
Shamim
The new pythian in town...
|
|
|
|
 |
|
 |
I'm about to start a pet web project and I have chosen to use Python for it.
But, I'm stuck at the beginning, because I have a dilemma about the framework to use.
From what I saw, there are two frameworks I like, Django and web2py.
Anyone here has any real experience with these two, or have a good reason why one it better that the other?
[edit]
What's the matter? Nobody uses Django, nor web2py, nobody uses python, or nobody visits this forum?
[/edit]
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
modified on Friday, November 20, 2009 2:07 PM
|
|
|
|
 |
|
|
 |
|
 |
I did that, more that once.
There are a lot of people arguing that Django is the better choice, and a lot arguing the opposite.
Nevertheless...I chose Django. So far, I like it.
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
|
|
|
|
 |
|
 |
Sorry for seeing the post soo late.
I don't know a single person using web2py in production so that may make it a tad scary to get started. I use Django and web.py professionally and it really is a question about your needs.
Personally, it took me some time to get comfortable with Django but now that I am I tend to prefer it.
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov
Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
|
|
|
|
 |
|
 |
I've made my choice, already
I decided to go with Django, and am quite happy with the decision, by now.
One of the biggest pros was the community around Django, something web2py can't really compete with.
After all, for learning a new framework, community tends to be quite important.
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
|
|
|
|
 |
|
 |
If you have questions about web2py and want more information about people running it on production, I would suggest you join (even if temporarily) the web2py google group. There are more than 1500 members and a lot of people using it in production who will be happy to share their opinions with you. You will find a very active community. The web2py community is younger therefore not as big as Django's.
As an axample, the PyCon 2010 registration site runs web2py in production. It used to run on Django but moved to web2py two years ago. http://us.pycon.org/2010/register
|
|
|
|
 |
|
 |
Hi,
I am making a game, where I want to move the character with mouse click. It is a tile based game with isometric view.
# mouse move
if e.type==pygame.MOUSEBUTTONDOWN:
#movehero
movehero=True
if e.type==pygame.MOUSEBUTTONUP:
movehero=False
if movehero==True:
# the movement code
Can anyone tell me how to get the position of mouse click so that the character will move there itself?
Kindly help
Thanks
|
|
|
|
 |
|
|
 |
|
 |
Any Python Gurus online?
If so please help me with the following error. I am the middle of writing a program and every time it runs the Python core crashes. After debugging and stepping through code the following block of code precedes the crash:
x = 16
while x > 0
x = x * x
Whats the error?
lol.......
|
|
|
|
 |
|
 |
Mike Stratton wrote: x = 16
while x > 0
x = x * x
Have you looked carefully at these statements?
|
|
|
|
 |
|
 |
The answer is simple really, I actually purposely created this code while learning python via MIT OpenCourseWare.
This code creates an infinte loop with the number calculations increasing beyond Pythons capabilities very quickly.
I thought it was kind of funny as the code says:
x is equal to 16
If you find that x is greater then 0 then do the following:
redefine x as is equal to 16*16
Second loop:
x is equal to 256
if you find that x is greater then 0 then do the following
redefine x as equalt to 256*256
Third loop:
x is equal to 65536
if you find that x is greater then 0 then do the following
redefine x as equal to 65536 * 65536
A few loops and python cannot compute.
|
|
|
|
 |
|
 |
x = 16
while x > 0:
x = x * x
You were just missing a :
and statements under a while, or for, or if, etc
must be indented
try it now
Mike
|
|
|
|
 |
|
 |
x = 16
while x > 0 :
x = x * x
Pavan Pareta
|
|
|
|
 |
|
 |
Is this supposed to add some value here?
|
|
|
|
 |
|
 |
The value added is a good laugh.
I am just having fun learning to code.
|
|
|
|
 |
|
 |
And the purpose of posting the question was what?
|
|
|
|
 |
|
 |
post = "function"
while input = 'function?':
print 'That was funny!'
else:
print 'That was Stupid'
|
|
|
|
 |
|
 |
My purpose was to try and find other programmers that share my enthusiasm for learning.
Have a good day.
|
|
|
|
 |
|
 |
This answer is partially correct.
Yes I forget the operative of : when typing this but the real problem is that it creates an infinite loop that causes Pythong to crash.
|
|
|
|
 |