Re: GHRML Documentation
Hi there, > I found a similar template language called GHRML (http:// > www.ghrml.org) for django, but the documentation on it is very scarce. > It's also very young (currently in v0.11), and I'm not sure if it's > even being actively developed anymore. I'm trying to find out if it > supports basic template stuff like "extends" and conditionals, so if > anyone who's using it could point me to some good docs on it, assuming > those exist, that'll be great. Thanks! I can't blame you, Django's template language is not particularly elegant or convenient to extend. I'm not using it currently. However, a cursory look at the source code doesn't reveal anything like this handling of layouts. If you do want something different than Django's template language, I'd suggest that you get a look at Mako (which is a general-purpose Python template language). You need to be aware, though, that if you choose a different template language, this will mean that you will have to call a different render_to_response/render_to_string. Which means, in particular, that if you want to use a third-party application which has its own views, you'll probably end up having to rewrite the views so that it can find your layout, for instance. Same for apps with their own tag library (like django-compress). Cheers, Emm --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: can you have a flatpage with url of "/" when Debug=True?
On Sat, Jun 13, 2009 at 7:24 PM, Michael wrote: > On Sat, Jun 13, 2009 at 1:30 PM, josebrwn wrote: >> >> If Debug = True, you can have a flatpage with URL = "/" that is >> handled by FlatpageFallbackMiddleware: >> >> MIDDLEWARE_CLASSES = ( >> ... >> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', >> ) >> >> If Debug = False, the flatpage will 404. Is there a way to have a >> flatpage as your site's index/home page, and have debugging turned >> off? > > I do this all the time. It works the same not-depending on the DEBUG > setting. It should work. > Do you have 500.html and 404.html templates in your template directory? That > is the only thing that I can think that would behave differently here. > How is it not working? A little more specifics will help us out greatly, > Michael I have this issues as well, and I have a 404 and 500 html file in my template directory. I still get a internal server error (not my 500 error page) when I turn debug off and have a flatpage url set to /. It works as long as debugging is on and since the two sites I use a flat pages as the home page get less then 500 hits a month I just leave it on --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
amCharts and Django
Anybody using amCharts with Django? I'd like to be able to hook the chart directly up to my model. I found this ( http://aaron.oirt.rutgers.edu/myapp/amcharts/doc) about using amCharts with WHIFF, and it seems like building the descriptor would be straight-forward, but then I'm clueless about the WHIFF/Django interaction. Anybody have any references I could go dig through? Thanks. tj -- Travis Jensen Email: travis.jen...@gmail.com LinkedIn: http://www.linkedin.com/in/travisjensen Blog: http://softwaremaven.innerbrain.com/ Twitter: http://twitter.com/SoftwareMaven --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GHRML Documentation
On Sunday 14 June 2009 10:24:52 gte351s wrote: > I'm trying to learn how to work with django after working with ruby on > rails for some time (not too long). Rails has a nice template language > called Haml (http://haml.hamptoncatlin.com/), which I find much more > readable than regular HTML. It is also indent oriented, which all > python fans must find appealing (myself included). so what do you not like about django's templating language? -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why django? Framework design or language
On Saturday 13 June 2009 20:29:47 Joshua Partogi wrote: > a) the language itself and they already master python, so they choose > django b) the design and the feature of the framework itself that fits > their needs I needed a framework using python and chose django as it was the first one I saw that preferred postgresql to mysql (I know the docs are neutral here, but I noticed that most of the core devels used postgresql). -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django easy to learn and use for my web project?
> same skill set as you and I learnt django and went into production in 9 days > (I had a deadline to meet and only missed it by 2 days) When i started to learn, i choose the stable version ,but with the need to use admin action i jump to dev version, an of course its many documentation i must read, sometimes djangobook.com and dev-doc is not help me. and i have no idea which ready-to-implement-modules-from-other to choose, and sometime.. where the doc..??? or the doc make me confuse... i'm an php programmer, very-very new to python, and i think i learn django before python :-p ^_^ --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Determining the type of a form field within a template
On Sun, Jun 14, 2009 at 12:08 AM, Thomas Sutton wrote: > > Hi Jashugan, > > On 13/06/2009, at 12:28 AM, Jashugan wrote: > > > > > On Jun 11, 8:49 pm, "thsut...@gmail.com" wrote: > > > >> > >> This has been trivial in every other framework I've used and I'm sure > >> it is in Django as well, but I'm completely stumped. Is there any way > >> to do this which doesn't require that I write custom code for every > >> form and/or checkbox in my project? > > > > You may be able to write a custom filter that takes in a field, and > > returns the type of field it is (see > > > http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters > ) > > . > > Then in your code you do something like: > > > > {% ifequal field|field_type 'checkbox' %} > > ... > > {% endifequal %} > > That's what I thought, but isn't `field` still an instance of > BoundField? And it still doesn't contain anything that lets me > determine the type of the original field (other than looking at the > generated HTML and taking a guess)? > > Cheers, > > Thomas Sutton > > > > field is a BoundField but field.field is the orignal field object Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Determining the type of a form field within a template
Hi Jashugan, On 13/06/2009, at 12:28 AM, Jashugan wrote: > > On Jun 11, 8:49 pm, "thsut...@gmail.com" wrote: > >> >> This has been trivial in every other framework I've used and I'm sure >> it is in Django as well, but I'm completely stumped. Is there any way >> to do this which doesn't require that I write custom code for every >> form and/or checkbox in my project? > > You may be able to write a custom filter that takes in a field, and > returns the type of field it is (see > http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters) > > . > Then in your code you do something like: > > {% ifequal field|field_type 'checkbox' %} > ... > {% endifequal %} That's what I thought, but isn't `field` still an instance of BoundField? And it still doesn't contain anything that lets me determine the type of the original field (other than looking at the generated HTML and taking a guess)? Cheers, Thomas Sutton --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
GHRML Documentation
I'm trying to learn how to work with django after working with ruby on rails for some time (not too long). Rails has a nice template language called Haml (http://haml.hamptoncatlin.com/), which I find much more readable than regular HTML. It is also indent oriented, which all python fans must find appealing (myself included). I found a similar template language called GHRML (http:// www.ghrml.org) for django, but the documentation on it is very scarce. It's also very young (currently in v0.11), and I'm not sure if it's even being actively developed anymore. I'm trying to find out if it supports basic template stuff like "extends" and conditionals, so if anyone who's using it could point me to some good docs on it, assuming those exist, that'll be great. Thanks! --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
openid
So after looking around a bit it looks like simonwilsons openid package is pretty where it's at for openid in django. Question is: is the package that hasn't been touched 2 years django_openidconsumer the right one to use or has django_openid come along far enough to implement/test. I note that there was an email further back that said django_openidconsumer doesn't work unless you use the openid2.0 branch so I'm a bit lost. Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django easy to learn and use for my web project?
I've only been using django for a few weeks. I had NO prior Python experience. I've been cracking a couple of hours a day on a site that aggregates RSS feeds and I've already got it working nicely. I've played with PHP and Rails before, and django feels to me like it's the easiest to use. I'm amazed at how little code I have compared to the functionality of my site. It so far seems to me that maintainablity should be eased by the way an app is organized by django. I followed along with www.djangobook.com and then googled or hit this group up for anything I wanted to know more about. On Jun 14, 3:29 am, "kakaruk...@gmail.com" wrote: > Hi All, > > I wish to learn something to create a website with the following apps: > a wiki, a blog, a site search, some social networking functions, a > page where a user may post question and other users may post answers, > e-commerce, other tiny functions that need to be coded manually. The > site needs moderately beautiful layout and graphics. After the website > is created, it needs to be maintained for a long time. There might be > new programmers coming in for future development. > > Here's my experience: > I'm an intermediate level python programmer, a beginner in perl, a > total novice in php & javascript. I'm also an intermediate level Linux > user. I have designed and maintained websites before, some sites in > HTML/CSS, a blog using a b2evolution (PHP/ mySQL) (a tool that was > already written by someone, the setup and admin interface is very > simple, so no coding was needed), maintained a site with CMS in PHP > (also no coding was needed) > > Could you roughly estimate for me how long do I need to learn and use > Django for my project? How long it takes to finish the project? > > Cheers, > J.F. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django easy to learn and use for my web project?
On Sunday 14 June 2009 05:59:30 kakaruk...@gmail.com wrote: > I'm an intermediate level python programmer, a beginner in perl, a > total novice in php & javascript. I'm also an intermediate level Linux > user. I have designed and maintained websites before, some sites in > HTML/CSS, a blog using a b2evolution (PHP/ mySQL) (a tool that was > already written by someone, the setup and admin interface is very > simple, so no coding was needed), maintained a site with CMS in PHP > (also no coding was needed) > > Could you roughly estimate for me how long do I need to learn and use > Django for my project? How long it takes to finish the project? 2 weeks to a month to get a site going with basic functionality - the rest of your life to make it perfect ;-). You do not really need to use javascript, at least at the outset. The key thing is to go into production as fast as possible and then keep adding modules. Start with the blog and the forum - there are ready made ones which you can plug in and modify, but to practise it is better to roll your own. For the blog you just need a couple of models and you can add django.contrib.comments for the comments part. I have about the same skill set as you and I learnt django and went into production in 9 days (I had a deadline to meet and only missed it by 2 days) -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: unsubscribe
On Saturday 13 June 2009 18:37:25 Lucas Hazel wrote: > From: Lucas Hazel > To: django-users@googlegroups.com > > -- > Lucas Hazel didn't work ;-) -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Amazon S3 for File Uploads
Max Clark wrote: > I want to use Amazon S3 for file uploads from users (models.FileField). > I have been searching and have come across these > three plugins/examples to use S3 with django... > > http://code.djangoproject.com/wiki/AmazonSimpleStorageService > http://www.sourceguru.net/archives/177 > http://code.welldev.org/django-storages/wiki/S3Storage Well, there's not much to it, just make sure to go over the Django settings for file uploading and see if they are fit for your needs. However, those libraries do share a common problem: the S3 upload happens within the request-response cycle. That might be okay for small files but if you need to handle the big ones you'll have to use a different approach: save the files to a temp folder, and have a daemon running as a separate process to upload them to S3. Files may not be immediately made available, but that's ok for a lot of applications, and it makes the request-response cycle faster and more scalable, considering you wouldn't be keeping so many threads around at once. I've just completed a full blown solution for this, including the daemons (and separate worker daemons to perform special operations on uploaded files, like video transcoding). I can't release the source, but if you'd like I could probably send you a few snippets privately. --Jonas Galvez --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
model inheritance and admin labeling
I am trying to create an abstract base class for a hierarchy. One of the fields in the base class is child_nodes, refering to 'self'. In the sub-class I cannot seem to find a way to control the labeling of the field in the admin. No matter what I do it comes up as 'Child nodes'. I want to change it to something that is related to whatever the name of the sub-class is, be it 'Group' or 'Category' or whatever. Ideally in the case of 'Group' the label would be 'Sub-Group' and so on. Can anybody help? --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: can you have a flatpage with url of "/" when Debug=True?
On Sat, Jun 13, 2009 at 1:30 PM, josebrwn wrote: > > If Debug = True, you can have a flatpage with URL = "/" that is > handled by FlatpageFallbackMiddleware: > > MIDDLEWARE_CLASSES = ( >... >'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', > ) > > If Debug = False, the flatpage will 404. Is there a way to have a > flatpage as your site's index/home page, and have debugging turned > off? > I do this all the time. It works the same not-depending on the DEBUG setting. It should work. Do you have 500.html and 404.html templates in your template directory? That is the only thing that I can think that would behave differently here. How is it not working? A little more specifics will help us out greatly, Michael --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Is Django easy to learn and use for my web project?
Hi All, I wish to learn something to create a website with the following apps: a wiki, a blog, a site search, some social networking functions, a page where a user may post question and other users may post answers, e-commerce, other tiny functions that need to be coded manually. The site needs moderately beautiful layout and graphics. After the website is created, it needs to be maintained for a long time. There might be new programmers coming in for future development. Here's my experience: I'm an intermediate level python programmer, a beginner in perl, a total novice in php & javascript. I'm also an intermediate level Linux user. I have designed and maintained websites before, some sites in HTML/CSS, a blog using a b2evolution (PHP/ mySQL) (a tool that was already written by someone, the setup and admin interface is very simple, so no coding was needed), maintained a site with CMS in PHP (also no coding was needed) Could you roughly estimate for me how long do I need to learn and use Django for my project? How long it takes to finish the project? Cheers, J.F. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: View arguments via url are not being passed to the view.
2009/6/13 wilby : > > Hi group, > > I am having a problem getting text in the url to be passed as > arguments to my view. > > My defined urls are: > > > (r'^notes/', 'notes'), Shoud be (r'^notes/$', 'notes'), if you mantain as it is it matches also notes/a/0/ so the second url never captures the parameters. -- Antoni Aloy López Blog: http://trespams.com Site: http://apsl.net --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
database backends timing out
I'm having an interesting problem. After inserting a bunch of records into my database ( about 400,000), it the database starts refusing connections. Even after restarting the database daemon, I can not query the database (django lets me query, but returns nothing in the querysets). The only method that works is dropping the tables and then I can attempt the import again. This happens with both mysql and pyscopg2-postgres backends. This is this error I get in my postgres logs: LOG: 08P01: unexpected EOF on client connection LOCATION: SocketBackend, postgres.c:323 DEBUG: 0: proc_exit(0) LOCATION: proc_exit, ipc.c:98 DEBUG: 0: shmem_exit(0) LOCATION: shmem_exit, ipc.c:164 DEBUG: 25001: SET TRANSACTION ISOLATION LEVEL must be called before any query I am using some rawsql to do an executemany, and I'm handling the transaction commits manually, but even when taken that code out and just using standard *.objects.create, and the results are still the same. The fact that it happens on 2 different database backends leads me to believe that it is a problem with the django database layer. This occurs with both the django stable version, and trunk. Any help would be great appreciated. Thanks, James --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
filtering between two different tables
Hi, I am pretty new to django and python as well. I am working on my first django project and trying to find the best approch to solve the following issue : On my project I do have a voting system. the votes are for a specific item. Each user can vote once per item. What I am trying to do is that a user can see all of the items he can vote excluding the ones he already voted on. here are the models for an example : class Item(models.Model) : user_owner = models.ForeignKey(UserProfile) item_notes = models.CharField(max_length=500); added = models.DateField() class Vote(models.Model) : item= models.ForeignKey(item) user = models.ForeignKey(UserProfile) notes = models.CharField(max_length=500); score = models.IntegerField() added = models.DateField(); The first filtering I am doing is to take away any items that are owned by the specific user. So I am doing the following : items = item.objects.exclude(user_owner = profile) On those items I now want to retrieve only the items that were not voted yet by the specific user. My problem here is that I cant use the objects.exclude because I want a specific entry on the item tabe to be compared with all the votes realted to the user. Any django way to do this ? or should I just use a for loop here ? Thanks in advance, Elad --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error loading MySQLdb module: libmysqlclient_r.so.16 - Help please
So I'm having an issue getting Django to work with MySQL. After I log into my Django site, I get the following error: ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory The error is being thrown from site-packages/django/db/backends/mysql/base.py line 13. Unlike a lot of similar posts on the message board (I have searched), I have MySQLdb installed. The lines in question are just 'import MySQLdb as Database' and the associated try/catch throwing the error. When I run python from a command line and type 'import MySQLdb' it imports just fine. I added to to the root's .bash_profile and the .bashrc of the 'mysql' user. The file definitely exists (in /usr/local/mysql/lib) I used the variable LD_LIBRARY_PATH in the two profiles to make the 'import MySQLdb' statement work, is that the correct environment variable? As a note, I installed mysql from the .tar.gz files and MySQLpython from the .tar.gz files as well. I can't use any sort of package manager to install this stuff. -- View this message in context: http://www.nabble.com/Error-loading-MySQLdb-module%3A-libmysqlclient_r.so.16---Help-please-tp24014308p24014308.html Sent from the django-users mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error loading MySQLdb module: libmysqlclient_r.so.16 - Help please
This is the author again. Of course, 10 minutes after I post a question, I find the solution. (After hours of searching beforehand) If anyone else has this problem, the solution for me was: edit /etc/ld.so.conf add the line: /usr/local/mysql/lib then run /etc/ldconfig Fixed the problem right up. No idea why or how this worked, but everything is working now. NoCleverName wrote: > > So I'm having an issue getting Django to work with MySQL. After I log > into my Django site, I get the following error: > > ImproperlyConfigured: Error loading MySQLdb module: > libmysqlclient_r.so.16: cannot open shared object file: No such file or > directory > > The error is being thrown from > site-packages/django/db/backends/mysql/base.py line 13. > > Unlike a lot of similar posts on the message board (I have searched), I > have MySQLdb installed. The lines in question are just 'import MySQLdb as > Database' and the associated try/catch throwing the error. When I run > python from a command line and type 'import MySQLdb' it imports just fine. > I added to to the root's .bash_profile and the .bashrc of the 'mysql' > user. The file definitely exists (in /usr/local/mysql/lib) > > I used the variable LD_LIBRARY_PATH in the two profiles to make the > 'import MySQLdb' statement work, is that the correct environment variable? > > As a note, I installed mysql from the .tar.gz files and MySQLpython from > the .tar.gz files as well. I can't use any sort of package manager to > install this stuff. > -- View this message in context: http://www.nabble.com/Error-loading-MySQLdb-module%3A-libmysqlclient_r.so.16---Help-please-tp24014308p24014469.html Sent from the django-users mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
can you have a flatpage with url of "/" when Debug=True?
If Debug = True, you can have a flatpage with URL = "/" that is handled by FlatpageFallbackMiddleware: MIDDLEWARE_CLASSES = ( ... 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ) If Debug = False, the flatpage will 404. Is there a way to have a flatpage as your site's index/home page, and have debugging turned off? -joe --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is it bad to rely on db exceptions?
get_or_create() is probably perfect, I just haven't come across it in the djangobook yet. I'm a newb. Gonna have to start combing the docs a little more thoroughly! Thanks for the suggestion! On Jun 13, 4:32 pm, Christian Schilling wrote: > the most obvious reason why this is bad is: it will stop working when > you switch > to an other database backend. > but aside from that: what are you trying to archive? > looks a lot like what the get_or_create() shortcut does... > > On Jun 13, 8:42 am, koepked wrote: > > > Is it bad practice to rely on db exceptions to indicate an attempt at > > writing duplicate values to a "keyed" column? For example, in some > > code I'm working on, I have the following: > > > x = ContentItem(title=e_title) > > > try: > > x.save() > > except MySQLError: > > x = ContentItem.objects.get(title=e_title) > > > for tag_title in tag_titles: > > y = Tag(title=tag_title) > > > try: > > y.save() > > except MySQLError: > > y = Tag.objects.get(title=e_title) > > > x.tags.add(y) > > > Catching the MySQLError indicates to me that that title already exists > > in the db, so I then retrieve it instead of inserting it. I have a > > feeling that some folks will say this is bad, but if so, I'm curious > > why. To me, it seems better than significantly increasing the # of > > queries I have to run to check if the data's already there before I > > write it. Thanks for any help. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: django-currencies 0.1
http://code.google.com/p/django-currencies/ "django-currencies allows you to define different currencies, and includes template tags/filters to allow easy conversion between them." The package is registered on cheezeshop, you can give a try by `pip install django-currencies` (or easy_install). Source is available at `http://panos.solhost.org/django-currencies` under bazaar. Please report any bugs at the googlecode issue manager. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Debugging methodology suggestion on PIL file upload problems
Finally getting back into the swing of things in studying django. I discovered 'Werkzeug debugger' and found out I was doing many things wrong (saving to wrong place, trying to open the Image prior to saving it locally, etc.). Great debugging tool (wish I had an IDE, but this is better than printing to files for debugging info, etc.). Any other great debugging tool you guys have used? On Thu, May 14, 2009 at 11:04 PM, MrBodjangos wrote: > Hi, > > Please give me pointers on how to debug this. > > Basic form error: > > "Upload a valid image. The file you uploaded was either not an image > or a corrupted image." > > I have googled around and the problems I have read regards recompiling > jpeg for MAC after installing PIL. I have Windows, and so I believe > everything is bundled correctly. > > I have a Windows XP box, Python 2.5, django 1.0, and Python Imaging > Library 1.1.6 for Python 2.5 (Windows only). > > I have created a simple form with a browse and submit. > > I upload a jpg file and the form keeps returning "Upload a valid > image. The file you uploaded was either not an image or a corrupted > image." > > Now, I know PIL is working because in the shell, I can do this: > -- > $ python manage.py shell > Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) > >>> from PIL import Image > >>> im=Image.open("C:\\my_wsgi\\media\\photos\\name.jpg") > >>> print im.format > JPEG > >>> > -- > > In my google search efforts, one suggestion was to just change the > raise exception in fields.py (C:\Python25\Lib\site-packages\django > \forms): > > class ImageField(FileField): > . > . > . > . >try: ># load() is the only method that can spot a truncated > JPEG, ># but it cannot be called sanely after verify() >trial_image = Image.open(file) >trial_image.load() > ># Since we're about to use the file again we have to reset > the ># file object if possible. >if hasattr(file, 'reset'): >file.reset() > ># verify() is the only method that can spot a corrupt PNG, ># but it must be called immediately after the constructor >trial_image = Image.open(file) >trial_image.verify() >except ImportError: ># Under PyPy, it is possible to import PIL. However, the > underlying ># _imaging C module isn't available, so an ImportError > will be ># raised. Catch and re-raise. >raise >except Exception: # Python Imaging Library doesn't recognize > it as an image > >raise # << I comment the original below, and I just call > raise here >>> >#raise ValidationError(self.error_messages > ['invalid_image']) > . > . > . > > > Having the raise bubble all the way up leads to: > > TemplateSyntaxError at /upload_file/ > > Caught an exception while rendering: cannot identify image file > > Original Traceback (most recent call last): > File "C:\Python25\lib\site-packages\django\template\debug.py", line > 71, in render_node >result = node.render(context) > File "C:\Python25\lib\site-packages\django\template\defaulttags.py", > line 241, in render >value = bool_expr.resolve(context, True) > File "C:\Python25\lib\site-packages\django\template\__init__.py", > line 535, in resolve >obj = self.var.resolve(context) > File "C:\Python25\lib\site-packages\django\template\__init__.py", > line 676, in resolve >value = self._resolve_lookup(context) > File "C:\Python25\lib\site-packages\django\template\__init__.py", > line 705, in _resolve_lookup >current = getattr(current, bit) > File "C:\Python25\lib\site-packages\django\forms\forms.py", line > 340, in _errors >return self.form.errors.get(self.name, self.form.error_class()) > File "C:\Python25\lib\site-packages\django\forms\forms.py", line > 111, in _get_errors >self.full_clean() > File "C:\Python25\lib\site-packages\django\forms\forms.py", line > 229, in full_clean >value = field.clean(value, initial) > File "c:\Python25\lib\site-packages\django\forms\fields.py", line > 505, in clean >trial_image = Image.open(file) > File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1916, in > open >raise IOError("cannot identify image file") > IOError: cannot identify image file > > > > So, it seems that one of these two are failing in fields.py: >trial_image = Image.open(file) >trial_image.load() > > Here is my question: > How do I find out what that 'file' is the Image object is trying to > open? > It would be nice if I can just put a print statement in between the > two, something like: >
Re: Why django? Framework design or language
On 13 Jun 2009, at 16:59 , Joshua Partogi wrote: > Hi all, > I know that this questions rise up often in this list, but I have a > different side of view about the reason to choose django. > > I was wondering whether most people here choose django because of: > > a) the language itself and they already master python, so they > choose django > b) the design and the feature of the framework itself that fits > their needs > > Okay, as for me, I chose django because of the design of the framework > itself and the feature django offer. I'm not really a python > programmer and > was not a python programmer back then. > > So what about you? > > Kind regards, A bit of both. I quite like Python as a dynamically typed language, more so than Ruby, PHP, JS, ... anyway, and I like the design & direction of django (the lack of magick compared to Rails which I tried before, the ideas of most batteries being included and working well together compared to e.g. Pylons, and the idea of pluggable apps which is a better modularity approach than pretty much everything else I've seen in the class, though I probably missed good ideas in other frameworks). --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why django? Framework design or language
Joshua Partogi wrote: > Hi all, > I know that this questions rise up often in this list, but I have a > different side of view about the reason to choose django. > > I was wondering whether most people here choose django because of: > > a) the language itself and they already master python, so they choose django > b) the design and the feature of the framework itself that fits their needs > > Okay, as for me, I chose django because of the design of the framework > itself and the feature django offer. I'm not really a python programmer and > was not a python programmer back then. I only use it because of (b), I don't care too much about Python and don't think it is a very good language (I prefer statically typed and functional languages). But Django makes it worth it :) -- Jochem Berndsen | joc...@functor.nl GPG: 0xE6FABFAB --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Why django? Framework design or language
Hi all, I know that this questions rise up often in this list, but I have a different side of view about the reason to choose django. I was wondering whether most people here choose django because of: a) the language itself and they already master python, so they choose django b) the design and the feature of the framework itself that fits their needs Okay, as for me, I chose django because of the design of the framework itself and the feature django offer. I'm not really a python programmer and was not a python programmer back then. So what about you? Kind regards, -- Join Scrum8.com. http://scrum8.com/member/jpartogi/ http://scrum8.com/blog/jpartogi/ http://twitter.com/scrum8 --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is it bad to rely on db exceptions?
the most obvious reason why this is bad is: it will stop working when you switch to an other database backend. but aside from that: what are you trying to archive? looks a lot like what the get_or_create() shortcut does... On Jun 13, 8:42 am, koepked wrote: > Is it bad practice to rely on db exceptions to indicate an attempt at > writing duplicate values to a "keyed" column? For example, in some > code I'm working on, I have the following: > > x = ContentItem(title=e_title) > > try: > x.save() > except MySQLError: > x = ContentItem.objects.get(title=e_title) > > for tag_title in tag_titles: > y = Tag(title=tag_title) > > try: > y.save() > except MySQLError: > y = Tag.objects.get(title=e_title) > > x.tags.add(y) > > Catching the MySQLError indicates to me that that title already exists > in the db, so I then retrieve it instead of inserting it. I have a > feeling that some folks will say this is bad, but if so, I'm curious > why. To me, it seems better than significantly increasing the # of > queries I have to run to check if the data's already there before I > write it. Thanks for any help. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
unsubscribe
-- Lucas Hazel --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
TemplateDoesNotExist: 500.html during deployment
Hello! I managed to deploy my django project in production except static media. When I try to access http://localhost/adminmedia/account.js (my static media file), I get colorful page with stack trace of django.template.TemplateDoesNotExist exception and TemplateDoesNotExist: 500.html in apache2 log. My project root is /var/www/webapps/katrin-web. I want to have /var/www/webapps/katrin-web/katrin/adminmedia located in /adminmedia. It seems that Django tries to serve static media instead of apache2. What's wrong with my static media? Why standart 500.html doesn't display? Here is my apache2 conf: NameVirtualHost localhost:80 ServerAdmin postmas...@localhost DocumentRoot "/var/www/webapps/katrin-web" ServerName localhost ErrorLog "/var/log/httpd2/katrin-error.log" LogLevel debug CustomLog /var/log/httpd2/katrin-access.log common Alias /media/ /usr/lib/python2.5/site-packages/django/contrib/ admin/media/ Alias /adminmedia /var/www/webapps/katrin-web/katrin/ adminmedia SetHandler None RewriteBase / Options +ExecCGI AddHandler fcgid-script .fcgi RewriteEngine On RewriteRule ^(dispatch\.fcgi/.*)$ - [L] RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] # some settings: PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media') MEDIA_URL = '/adminmedia' ADMIN_MEDIA_PREFIX = '/media/' STATIC_DOC_ROOT = '/adminmedia' --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
View arguments via url are not being passed to the view.
Hi group, I am having a problem getting text in the url to be passed as arguments to my view. My defined urls are: (r'^notes/', 'notes'), (r'^notes/(?Pa|e|d{1})/(?P[0-9]*)/$', 'notes'), My view is as follows: @login_required() def notes(request, action=None, id=0): if action == 'a': n = Notes() n.note = request.POST["note"] n.user = request.user n.save() elif action == 'e': pass elif action == 'd': pass notes_list = Notes.objects.filter(user=request.user) return render_to_response("pim/notes.html", { "notes" : notes_list, "action" : action, "id" : id}) When I navigate to domain/app/notes the template is displayed and I have the action and id being printed to the page as 'None', and '0'. When the page gets posted to domain/app/notes/a/0/ I get the same exact information back and if action == a is never executed. I have read through the docs over and over and it looks like I'm doing it correctly but I guess I'm not. Does anyone have an idea what I'm doing wrong? --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie question on ContentTypes and Generic Relations
On Jun 12, 8:54 pm, Rana wrote: > Hi, > > I am trying to modify a blog and article model that will both display > data from a related products model. I read that the way I should do > this is through the ContentTypes framework and generic foreign > relations. I would be grateful for some guidance on how to do this. > I've read the documentation on > thehttp://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/ > website, but I am struggling with how to relate it to what I need to > do. > > I have something like this presently: > > articles/models.py > --- > class Article(models.Model): > author = models.ForeignKey(User, related_name='article_author') > headline = models.CharField(max_length=256) > publish_content = models.TextField(blank=True) > ... > related_product = models.ManyToManyField('RelatedProduct', null=True, > blank=True) > > class RelatedProduct(models.Model): > product_name = models.CharField(max_length=256) > product_link = models.TextField(max_length=512) > > blogs/models.py > > class Blog(models.Model): > name = models.CharField(max_length=128) > long_description = models.TextField() > short_description = models.TextField() > > I would like to modify this so that I can have the related products > from articles also available in my Blog class and the related products > table should be the same between Article class and Blog class, i.e. I > do not want to have two instances of the RelatedProduct class. > > Thank you for any help you can offer. > > Rana You don't need generic relations here, just add a related_product ManyToMany field do the Blog model in exactly the same way as you did for the Article model. -- DR. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---