0

Well main question of the day will django work correctly under python 2.5.2 ?

So why i am asking this question?

First of all i have some test class written , nothing special which renders a page. The problem is that everytime i access this page i get random 3 different responses :

1)exceptions must be classes, instances, or strings (deprecated), not type

2) Http404

3) page renders normally .

And generally i can refresh until i get the result i want , well in my case normally rendered page. I am a little bit confused what even to think . Because my written class does pretty much nothing.Just a test class to test some things.

I run Django 1.2.3 under python 2.5.2 on Debian .

Also what i noticed . I use PyCharm 1.1.1 through remote host with auto upload every time change is made , it uploads but somehow changes are not always applied after initial upload . What i mean is that it feels like files are not compiled ~~ if u can say it this way ...

What's teh chance that it has basically nothing to do with python and django O_O and that are some other weird bugz ?

Viktor
  • 580
  • 2
  • 14
  • 29

3 Answers3

0

Yes, it is compatible: http://docs.djangoproject.com/en/dev/releases/1.2/#python-compatibility

Post your class -- there could be thousands of reasons it's not working correctly.

PyCharm and your host not updating files on your host would have nothing to do with Python or Django, but rather PyCharm and how it's uploading to your host.

tkone
  • 22,092
  • 5
  • 54
  • 78
  • Yeah.I totally agree. The point is there is even nothing to upload. Because i now deleted everything , and tried to run just with def asd(request): render_to_response('asd.html') and it constantly shows me errors something like there is no 'name 'asd' is not defined' or 'asd didn't return an HttpResponse object.' and some other errors shifting , which are totally impossible. It feels like it froze on somekind of state and doesn't update O_O.I could think that that was a PyCharm uploading problem , but the code gets uploaded correctly. And i can assure you that there is nothing wrong with code – Viktor Mar 06 '11 at 15:49
  • There is ofcourse return render_to_response ..... just had no space to write it. So i am little bit lost why everything was working correctly and then everything just crashed ... – Viktor Mar 06 '11 at 15:50
  • without seeing your code we are all just as lost and confused – tkone Mar 06 '11 at 15:56
  • Oh. Well. The weird thing is , after about 30 refreshes everything started working again .... So i don't even know what to say. Maybe i explained the problem a little bit wrong. I don't really know how django works with files , but it feels like sometimes after file upload it somehow doesn't compile files so it freezes at some point until i don't know u refresh 30 times and shows old errors even though code is correct. So the question is really not about the code correctness... Well anyway if anyone has any guesses why it might be please feel free to comment ... – Viktor Mar 06 '11 at 16:03
0

After a more thorough search i found this topic Restarting a Django application running on Apache + mod_python , which explains probably everything. Except i still don't really understand why mod_python sometimes does apply changes without apache being restarted sometimes i doesn't ..

Community
  • 1
  • 1
Viktor
  • 580
  • 2
  • 14
  • 29
0

By default mod_python decides when to reload, so you'll get what you get when you get it.

Maybe I am mistaken, but I thought there was a directive you could send that would explicitly force the python reload now. That should (in theory) help with achieving consistent but perhaps not ideal, behavior.

Off topic, this sounds like a good opportunity to enhance your app's logging so you'll have better breadcrumbs to follow next time things hang.

Rob
  • 7,420
  • 3
  • 17
  • 12
  • Well thats what i found about mod_python and Django on official site " If you use mod_python for your development server, you can avoid the hassle of having to restart the server each time you make code changes. Just set MaxRequestsPerChild 1 in your httpd.conf file to force Apache to reload everything for each request. " . But after reading a little bit in the internet seems like this solution doesn't work for everyone or has some flaws . And i agree , i should really start logging =))) – Viktor Mar 07 '11 at 23:20