2008-8-2
| 22:57 | rozwell | Kaell: you have to do that regardless |
| 22:58 | Lollipopz | mmm |
| 22:58 | Lollipopz | haven't had a look at sys.path yet... seems very usefull! :) |
| 22:58 | rozwell | err |
| 22:58 | rozwell | os.path that is :) |
| 22:58 | Lollipopz | this django isn't like php frameworks indeed! LOL! there is so much stuff!! |
| 22:59 | rozwell | well django is just python |
| 22:59 | rozwell | and python does differ significantly from PHP, yes |
| 22:59 | rozwell | clean namespacing, sensible syntax, etc :) |
| 23:00 | Lollipopz | geez... python is a dream come true :D |
| 23:00 | Kaell | yeah, os, sorry, i just woke up >< |
| 23:01 | Lollipopz | i thought I might give a look at Django and python 3 days ago... damn... |
| 23:01 | Finder | Except...I still have to change every render_to_respones to include the request, right? |
| 23:01 | Lollipopz | I think it's the best choice I ever made :) |
| 23:01 | Finder | 'cause RequestContext takes request and context as parameters |
| 23:01 | mattmcc | Finder: Search, replace. |
| 23:01 | rozwell | Finder: if you want to use context_processors you need to pass context_instance=RequestContext(request), yes |
| 23:01 | mattmcc | A good editor can do it for all your files in one swipe. |
| 23:02 | rozwell | sed to the rescue! |
| 23:02 | Finder | Yeah, it'll be just as easy to do it manually. ;) |
| 23:02 | mattmcc | I find that hard to believe. |
| 23:02 | rozwell | Finder: it pays to know how to automate these kinds of things |
| 23:03 | Finder | Well, manually as in search and replace once per file |
| 23:03 | Finder | I don't really want to have to look up how to do directory parsing and stuff in vim... |
| 23:03 | Kaell | if its 2 spots, it may be just as easy either way... if its over a dozen, a single command will be easier (assuming you are familiar with the necessary tool) |
| 23:03 | Kaell | but yeah, if you dont know already, it may take substantially longer, of course, if you learn it now, then next time it'll be easy :) |
| 23:05 | Finder | Yeah, probably true...a 2 hour vim read increased my productivity by at least 50% |
| 23:06 | mattmcc | Initial cost, long term reward.. :) |
| 23:07 | timboy | does the built-in web server serve up images? I see it supposedly get the image but it doesn't show up on the page... |
| 23:08 | rozwell | timboy: you have to tell it to |
| 23:08 | mattmcc | It can, with the static serve view. |
| 23:08 | rozwell | |
| 23:08 | timboy | rozwell, thx |
| 23:09 | Jippi | Hmm, any ideas on how to fix "ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined." Not sure what I changed, but it suddently broke everything :o |
| 23:09 | rozwell | Jippi: you have to set the environment variable yourself |
| 23:09 | mattmcc | Pretty unambiguous error. |
| 23:09 | rozwell | Jippi: manage.py will do it for you |
| 23:09 | Jippi | rozwell: Hm, I'm executing manage.py |
| 23:10 | Jippi | |
| 23:11 | mattmcc | Eh, manage.py doesn't depend on that environment variable. |
| 23:11 | mattmcc | You might want to make sure the settings module can be imported (syntax errors, perhaps?) |
| 23:11 | Finder | It does if you're doing runserver, right? |
| 23:11 | mattmcc | Nope. |
| 23:12 | Finder | How does it know what database to load? |
| 23:12 | Jippi | mattmcc: Hmmm |
| 23:12 | mattmcc | It just uses a relative import. |
| 23:12 | rozwell | |
| 23:13 | mattmcc | You can also pass a --settings= argument |
| 23:13 | mattmcc | But I'd first guess a syntax error being the cause. |
| 23:14 | Finder | Maybe the settings.py lost read access? |
| 23:15 | rozwell | with manage.py a settings import error would be noted right away |
| 23:15 | Finder | Well, it's switching over on if not settings.DATABASE_ENGINe |
| 23:15 | Finder | So it sounds like a problem with the settings file |
| 23:16 | Jippi | rozwell: Cant find any syntax errrors in any of those files the paste mentioned |
| 23:17 | rozwell | Jippi: it seems like you're doing something weird in your project's __init__.py |
| 23:18 | rozwell | Jippi: ah yes, it's right there |
| 23:18 | rozwell | Jippi: don't do stuff in your project's __init__.py |
| 23:18 | Jippi | rozwell: Hmm, found the "error" - my shell was fucked... i reloaded bash and it just .. worked |
| 23:18 | timboy | rozwell, I set that up properly I believe and I set my path to /home/tim/tmp/ and on my page the source code shows: <img src="../tmp/BMW_Logo.png" alt="750LI"> |
| 23:19 | rozwell | timboy: you set what path? |
| 23:19 | rozwell | timboy: project_settings.MEDIA_URL is the path for which you should set up the static serve view |
| 23:20 | rozwell | timboy: settings.MEDIA_URL is used by the media context processor |
| 23:20 | rozwell | timboy: and then settings.MEDIA_ROOT is where your media resides |
| 23:20 | rozwell | timboy: the filesystem path to it |
| 23:22 | davidcramer | hrmm |
| 23:23 | davidcramer | I'm hoping to achieve something along the lines of list_of_modules = __import__('my.module') and then looping through each to check an attribute, if its proper, do an import on it |
| 23:23 | davidcramer | but doing the import on my.module doesn't seem to get the 'module' part |
| 23:25 | espeed | trouble with admin.py -- if I don't import dev.blog, I get "Error while importing URLconf 'dev.urls': name 'Entry' is not defined" |
| 23:26 | espeed | however, if I do import it, the error goes away, but there isn't admin for Entry isn't included on the admin page |
| 23:26 | equark | how does django do messaging pass across redirects? like rails's "flash" objects? |
| 23:26 | rozwell | davidcramer: see http://docs.python.org/lib/built-in-funcs.html#... |
| 23:26 | equark | Basically want to to "Save successful" after a redirect for a user... |
| 23:26 | rozwell | espeed: what do you mean "if i import ..." ? |
| 23:27 | davidcramer | ah i get it |
| 23:27 | rozwell | equark: look at the django.contrib.auth code |
| 23:27 | espeed | I mean include from dev.blog import Entry on the top of the admin page |
| 23:27 | rozwell | espeed: you're not making a whole lot of sense |
| 23:27 | rozwell | espeed: if you want to register a modeladmin you need to pass the register function the modeladmin class and the model class |
| 23:28 | davidcramer | any easy way to get the list of modules vs using dir() ? |
| 23:28 | rozwell | espeed: so you would have to import the model you want to register |
| 23:28 | equark | rozwell: these are anonymous users... |
| 23:28 | rozwell | equark: you would have to associate a message model with a session then |
| 23:28 | rozwell | equark: and make sure all users have a session |
| 23:29 | espeed | in the Django tutorial, it does not import the poll app... |
| 23:29 | espeed | from django.contrib import admin |
| 23:29 | espeed | admin.site.register(Poll) |
| 23:29 | DeadPanda | has there been a refactor of django.db for 1.0? |
| 23:29 | rozwell | espeed: note how it says to do that in models.py |
| 23:30 | rozwell | espeed: but i would recommend you make an admin.py in your app |
| 23:30 | rozwell | espeed: define your ModelAdmins there and register them there, which requires that you import the models you want to register |
| 23:30 | DeadPanda | I'm just poking round and I can't find the old class in method definition (for ManyToMany?) that used to make me cringe |
| 23:31 | rozwell | DeadPanda: there was a refactor that hit trunk a few months back |
| 23:31 | DeadPanda | rozwell: sounds about right, it's been over a year since I was looking at this stuff, thanks :) |
| 23:31 | espeed | rozwell: I think I've tried that, but it's not reflected in the admin page... |
| 23:32 | peritus | DeadPanda: you should check out this page: http://code.djangoproject.com/wiki/BackwardsInc... |
| 23:32 | espeed | from django.contrib import admin |
| 23:32 | espeed | from dev.blog import Entry |
| 23:32 | espeed | class EntryAdmin(admin.ModelAdmin): |
| 23:32 | espeed | ... |
| 23:32 | espeed | ) |