Re: Tutorial 2 admin Template not found
I got the svn version, and "installed" from it into my Python2.5.1 - on Windows... After reading this, I looked at the site-packages/django/contrib/admin directory -- it was missing the media and templates directories... I gave up, and svn'd into my Python area too (and all seems well now). Is there a problem w/ the install script I wonder? On Dec 23 2007, 7:24 pm, kadavy <[EMAIL PROTECTED]> wrote: > Thanks, everyone, > > Jeff, I installed the SVN version, like you said - and it worked! I > guess I was under the (apparently false) impression that the official > release would be better to install than the SVN version. > > On Dec 22, 3:47 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > > I have no problems going through the tutorial (and creating my own apps) > > on my mac. Are you using the development server to do all of this? I > > could see where you'd have the problems you are having if you are trying > > this all through apache/mod_python. > > How did you install django? from source? I don't know if there is a > > darwinports or a fink package out there. The way I installed django on > > my mac (running leopard) was like this: > > > cd /Library/Python/2.5/site-packages > > sudo |svn cohttp://code.djangoproject.com/svn/django/trunk/djangodjango > > > I never had to do anything like manually configure the admin TEMPLATE_DIRS. > > I am using the development version, and I haven't been around long > > enough to know for sure, but you may be experiencing a bug related to > > django-0.96/mac. > > > You do need to map a URL for the admin media url in a production > > server--like apache. On my production server, I haven't bothered to get > > it working, so my admin interface is very boring and plain looking, but > > I don't really use it anyway. On the django built-in development server > > it should just work. > > > Good Luck! > > > Jeff Anderson > > | > > > kadavy wrote: > > > So I've discovered that I can get the admin page to show up if I add '/ > > > System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > > site-packages/django/contrib/admin/templates' to TEMPLATE_DIRS in the > > > settings.py file for my project (for some reason this doesn't work in > > > global_settings.py). > > > > But admin shows up with no styling. Looks like my "MEDIA_ROOT" is > > > wrong? I tried entering '/System/Library/Frameworks/Python.framework/ > > > Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/media', > > > but that doesn't work...and how am I to know the MEDIA_URL? Don't I > > > have to map a URL or something? Is this stuff just not covered in the > > > tutorial? > > > > Clearly I'm confused and have lots of questions - hopefully someone > > > can help me make sense of at least one or two of them. > > > > Thanks so much for your help. > > > signature.asc > > 1KDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Please Assist Learning Programming and Python with Django Framework and Stuck
On Saturday, June 16, 2012 5:10:34 AM UTC-5, cmac0tt wrote: > > So python is what I chose to learn, using the Django framework. > > I had this project working, then it just stopped out of nowere when I was > about to show one of my two bosses. Anyone able to give any insight? I put > everything in a DPASTE. > > First it kept telling me that line 45 (which didnt exist was "unindented", > I did a %retab and fixed it. Not sure how, my .vimrc settings are correct. > But after that starting bugging out then it didnt like my final redirect > even though it was working before hand. Note there is no other errors. It > basically doesnt like my HttpResponseRedirect at the end of the last view > (see dpaste) > > Remember I am total n00b so snake talk can go over my head sometimes. So > if you feel like helping please try to explain why not just what if that > makes sense (if you dont mind). I would appreciate it greatly! > > here is the dpaste: > > http://dpaste.com/760213/ Line 44 is an error: unless you've defined it (you didn't), there is no "write()" - it seems like you took someone's comment too literally: I imagine something like this was said "To save a wiki page, you have to ... um save it somehow, you know - print(), or write(), or something!" --- and you put print(), and write() in your code, without understanding why you were doing that. So - contents of a wikipage which your program is enabling someone to create, must somehow persist between visits. This can happen any number of ways, and you (basically) choose / decide / design how you will to this. You can store the contents of the page in: - a database entry; - a file - .. The "magic" you are not grasping is that, in Django, models are Python abstractions (representations) of a database table. You (thankfully) don't have to worry about SQL, or creating a database - just interact with the model, and all the stuff with the backend (be it sqlite, or some other database) is magically translated and done for you. SO - since you are using django models, you are storing to a database. That means you don't need to use "print" to put some content in some file (you didn't even connect the content, nor the output destination in your print statement, so that would have been missing anyway); That means you don't need to use a file write() method (you didn't have it associated with a file handle, nor with any content to write, so that wouldn't work as written anyway - see http://docs.python.org/library/stdtypes.html?highlight=write#file.write); All you need is the model's instance ("page" in your case), and use it's save() method (not unlike you might use a file's write() method) --- see https://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-the-api As for try:/except: --- they need to be in pairs. You put this around something which you think might sometimes fail (like show a page, but the page doesn't exist yet). You try; if anything indented under the "try" fails, the "except" line lists which error names it tries to recover from (that is, you can have more than one except, each trying to recover from a certain kind of error). In the case of view_page(), you do a render to "create" (did you want a redirect instead?). BTW, the last two lines under except need to be out-dented (lines 21-22) - when they are, you will see that you have done "content = page.content" twice in a row: once under the "try" clause, and once again, right after the "try" clause (that is, right after it just succeeded). Pick a place to put this, and have it in one place (I would do it outside the "try"). Hopefully, this gives you a start at understanding what you have, what you are trying to do. Regards, Yarko -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/nx5xpsrwxIMJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: map in django
You might try browsing these: http://pyvideo.org/search?models=videos.video&q=making+maps http://inzane.net The code from Zain's US PyCon2012 tutorial on making interaxtive maps is also in his github repositories - you might find that interesting. Have lots of fun! -Yarko -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/rj3DGy7wajoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Forms for updating a compound model
Have a look at this section and seder if it helps: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/iBeqayDPNZkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.