Re: deploying in server and templates folder is wrong:
On Jan 10, 3:44 pm, Alan wrote: > Hello List, > So, using django server por development and my apps were working fine. Now > that I got apache2 + mod_wsgi working (on Mac Leopard), when trying to > access a page, I always get a error saying "TemplateDoesNotExist" and I can > see why, it's looking for templates in $HOME folder (eg. > "/Users/alan/templates/index.html" but it is in " > /Users/alan/workspace/webapps/templates") and obviously they are not there. > > Any idea of what is going wrong here? Any help would be very appreciated. > > Many thanks in advance. > > Alans. You need to edit your settings.py file and change your TEMPLATE_DIRS to point to the new location. Steve --~--~-~--~~~---~--~~ 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: External link hit counter
Your best bet would be to achieve this using Ajax. Check out these basic tutorials: http://www.b-list.org/weblog/2006/jul/31/django-tips-simple-ajax-example-part-1/ http://www.b-list.org/weblog/2006/aug/05/django-tips-simple-ajax-example-part-2/ Steve On Aug 31, 8:00 pm, Yury Lifshits <[EMAIL PROTECTED]> wrote: > Dear All, > > How can one implement a hit counter for external link in Django? > I am coding a directory of companies [ it's in > Russian,http://shopping2.ru/business > ]. > Every company profile has an external link to company's website. > I want to display a number of times this link was clicked. > > The link should be direct, not like /counter?serve=http:// > company.com > > Of course, I just add an integer field "clickcounter" in company > model. So the display part is easy. > The question is how to "catch" the click event. I know there is > "onclick" attribute and some javascript code can be called there. > > Are there few lines of javascript that will send an "update counter" > message to django, while user is walking to an external website? > > Thanks, > Yury. > > P.S. I've foundhttp://code.google.com/p/django-simplestats/but it is > a general statistics engine while I only need a thing described above. --~--~-~--~~~---~--~~ 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: Revised: datetime formatting (mysql vs. django)
I can't say for sure, but I believe that the now button in the admin is a javascript. So I think that is where you need to look to control the output. Steve On Aug 29, 4:14 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > Hi All, > > Im *still* :-( trying to get the date format from -mm-dd to dd-mm- > > After a major dig into mysql, it seems that the date format in it's tables is > always -mm-dd. Normally, depending on your locale, date and/or time > stamps are formatted on the fly. > > I changed all the date related settings like DATE_FORMAT (also the ones in > Mysql). Then what leaves me is how Django's DATE_FORMAT fits in. And why does > a 'now' button on the admin pages keep giving me the reverse version. > > Anybody who knows anything about this ... Please help! > > Regards > > Gerard. --~--~-~--~~~---~--~~ 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: Strategies for staying current with django development
Personally when the newforms-admin was merged I quit updateing django so I wouldn't have to make multiple changes to my code before the 1.0 release. Then I planned to move everything to 1.0 and stay with it until another major release (or until there was a new feature I couldn't live without :-). Since the date for the 1.0 release is nearing I decided yesterday to try to port some of my code to the current SVN to see how hard it was going to be. It turns out it wasn't bad at all. To answer some of your other questions below; I don't think there are any changed to the auth table. To get he newforms admin working I just removed all of my Admin classes from the models.py and created new ones in the admin.py as per the Django documentation. As well as updating the urls.py to the new format for admin and adding the admin to the installed apps list. Then is just worked. If you look in the django-users archive I think I remember a few other people having the same auth problems you are describing, however I don't remember the solution. Steve On Aug 25, 3:43 pm, Gremmie <[EMAIL PROTECTED]> wrote: > I checked out the latest django from SVN some 14 weeks ago and built a > site with it. It rocks. :-). Yesterday, I decided to port my code to > the latest to take advantage of the newforms-admin. I had to update my > Photologue app also. A lot of stuff has changed! I am not quite there > yet, but I can finally get my admin page to come up, but django is now > saying my user doesn't have permission to edit anything. I am aware of > the backwards incompatible change list on the wiki, but to be honest, > a lot of it is over my head as a newbie. I don't speak django- > developer (yet). Nothing jumped out at me regarding authorization > changes. So my current theory is that there must be some auth database > table changes. I am thinking that I should save off all my site > database data, then drop all my tables and syncdb again. Or perhaps > point my site to a blank database and syncdb. Then use mysqldiff to > compare old and new databases and see what changed. I can possibly re- > import my data by re-running the old SQL, although I may need to > rename fields and do other fiddling, etc. > > I was able to save my Photologue data by saving it with phpMyAdmin, > dropping the tables, syncdb, then studying the new structures. I could > then re-run my saved SQL to get my data back, but I did have to make a > few tweaks. In one case, I had to add back 2 columns to a table, re- > import, then dropped those 2 columns to avoid fiddling with the saved > SQL. > > What strategies do people use to keep up with the moving target that > is django? Are there easier ways than what I am doing? > > Updating more often than once every 14 weeks is a good idea. :-) --~--~-~--~~~---~--~~ 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: help implementing search in django
I really don't have any experience with this. However if I was trying to implement a search, the first thing I would do is look at the Django Admin code and see how it was done there. Steve On Aug 25, 1:15 pm, chefsmart <[EMAIL PROTECTED]> wrote: > Please seehttp://dpaste.com/hold/73759/I need some guidance > implementing search feature in django. > > What I want to do is to be able to search for Regions. Let's suppose > we have: - > > A page where the user will be able to specify (a) one or multiple > states from a list, (b) one user to match with "created_by", (c) one > user to match with "modified_by". All these three search criteria are > optional, that is, if all three are not specified, the search returns > all regions. If one or more criteria are specified, the search returns > Regions that match all criteria. > > 1. how do I construct the search page? > 2. How do I perform a search based on the values obtained when the > search page is submitted? > 3. The values returned are not django models, of course. How do I > translate the values obtained so that they represent their > corresponding django models? > 4. How do I perform the query to search Regions? > 5. The Regions found in search are django models or python data types? > > I know that's a long list, but I have been trying this for too long > now. I just couldn't figure out how to do this... > > Your help is greatly appreciated. > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Admin problems :(
What Erik is saying is that in recent versions of Django you no longer use the same syntax to activate the admin. This happened when the newforms-admin branch was merged. Steve On Aug 24, 10:13 am, Shadow <[EMAIL PROTECTED]> wrote: > ah... :P thanks > > But what about the "Change password" link? > > Not that it really matters... but wondering if its another thing I'm > doing wrong? > > cheers > > On Aug 25, 12:53 am, Erik Allik <[EMAIL PROTECTED]> wrote: > > > You should consult the documentation (not djangobook.com) about how > > the admin site should be set up. > > > Erik > > > On 24.08.2008, at 17:20, Shadow wrote: > > > > Hi, I'm having some issues with the admin app (using svn rev #8520). > > > > 1) I can't get my apps models to show (logged in as superuser). > > > > I've added: > > > " > > > class Admin: > > >pass > > > " > > > to each one with no affect. But I can still see them in user > > > permissions?! > > > > 2) The "Change password" link gives the following: > > > >http://dpaste.com/73515/ > > > > Any help would be much appreciated, > > > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Write Caching
This is an interesting idea that I wouldn't have thought of. However, I'm not sure that every select is equal to a display. For example if I load the objects via the admin. Also, I am not sure as there would be a huge gain as the same number or queries would still be executed, however in this case the database is initiating some of them instead of Django. Steve On Aug 24, 5:59 am, TiNo <[EMAIL PROTECTED]> wrote: > Maybe this could be a > solution:http://www.stardata.it/articoli_en/triggers_on_select_articoli_en.html > > No idea how much overhead that would create though. > > On Sun, Aug 24, 2008 at 5:43 AM, Steve Potter <[EMAIL PROTECTED]>wrote: > > > > > I am working on a project that involves logging every time an object > > is displayed, and I can have anywhere from tens to hundreds of objects > > displayed per page. > > > So needless to say I can quickly be generating very large numbers of > > queries to the database to log all of these displays. > > > What I am looking for is some method of write caching these logs so I > > only write to the database every 'n' times the object is displayed, or > > when the cache gets too old. > > > Has anyone done anything like this? > > > Maybe someone just has a better suggestion for how to log this data > > with less DB queries? > > > Thanks, > > > Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Write Caching
I am working on a project that involves logging every time an object is displayed, and I can have anywhere from tens to hundreds of objects displayed per page. So needless to say I can quickly be generating very large numbers of queries to the database to log all of these displays. What I am looking for is some method of write caching these logs so I only write to the database every 'n' times the object is displayed, or when the cache gets too old. Has anyone done anything like this? Maybe someone just has a better suggestion for how to log this data with less DB queries? Thanks, Steve --~--~-~--~~~---~--~~ 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: CSV updater, 2 saves in one function. Problem?
> > print update_sku, update_stock > #Returned the whole feed > 2817312 130 > 2842300 22 > 2846762 50 > 2859391 22 > BPC60SS 22 > BPC70SS 2 > BPC90SS 2 > BPS60SS 22 > BPS70SS 22 > BPS90SS 22 > BTD600 22 > BWC150SS 80 > BWC300SS 22 > > print p.sku, p.items_in_stock > #Returned only the last line > BWC300SS 22 > > I don't get it why it didn't return the full excel feed again. I was looking at your code on dpaste and I cannot see a reason why the last print line would only run once. The only reason I could think of is maybe you have a mix of white- space characters in your file. You should use either tabs, or spaces to indent your code, not both. Does your editor offer an option to show tabs and spaces so you can see if you have a mix? Steve --~--~-~--~~~---~--~~ 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: ugh, TypeError: Cannot resolve keyword err ...
On Jun 20, 12:20 pm, Milan Andric <[EMAIL PROTECTED]> wrote: > This TypeError message always baffles me and is hard to debug. I'm > using SVN 6962 which means I should probably upgrade, but I tried that > a month or so ago around query-set-refactor merge and things were > unhappy so decided to wait. > > TypeError: Cannot resolve keyword 'presentation' into field. Choices > are: groups, user_permissions, tutorial, forum_post_set, subscription, > logentry, application, ... > > Here's two stack traces that cause the problem: > > http://dpaste.com/57816/http://dpaste.com/57701/ > > Here's the patch that causes both of them, very odd: > > Index: /workshops/models.py > === > --- /workshops/models.py (revision 967) > +++ /workshops/models.py (revision 1015) > @@ -1217,11 +1217,20 @@ > return dir_choices > > +def get_member_pks(): > +""" > +Return unique list of user id's that are staff or have been > accepted. > +""" > +dict={} > +for u in User.objects.filter(is_staff=True): > +dict[u.pk]=True > +for u in > User.objects.filter(application__status=Application.ACCEPTED_STATUS): > +dict[u.pk]=True > +return dict.keys() > + > workshop = models.ForeignKey(Workshop) > members = models.ManyToManyField( > User, > -limit_choices_to={ > -'application__status' : > Application.ACCEPTED_STATUS, > -}, > -help_text="This list is limited to people accepted in > a workshop. ", > +limit_choices_to= {'pk__in': get_member_pks()}, > +help_text="This list is limited to people accepted in > a workshop or staff. ", > filter_interface=models.HORIZONTAL, > ) > > Here's the model the patch applies to: > > class Project(models.Model): > > def get_dir_choices(): > """ > returns a tuple of tuples of directories for use with choices > in a > selectfield. > """ > import os > import re > dir_choices = [] > # only go 4 dirs deep from project_static_root > match1 = re.compile('^[^/]+/[^/]+/[^/]+/[^/]+$') > match2 = re.compile('^[^/]+/[^/]+/[^/]+$') > for root, dirs, files in > os.walk(settings.PROJECT_STATIC_ROOT): > for d in dirs: > d = os.path.join(root, d) > d = d.replace(settings.PROJECT_STATIC_ROOT, "", 1) > # relative path is stored in DB > if re.search(match1, d) or re.search(match2, d): > # check for index.html > if os.path.isfile(settings.PROJECT_STATIC_ROOT+d > +os.path.sep+'index.html'): > dir_choices.append((d, d)) > return dir_choices > > def get_member_pks(): > """ > Return unique list of user id's that are staff or have been > accepted. > """ > dict={} > for u in User.objects.filter(is_staff=True): > dict[u.pk]=True > for u in > User.objects.filter(application__status=Application.ACCEPTED_STATUS): > dict[u.pk]=True > return dict.keys() > > workshop = models.ForeignKey(Workshop) > members = models.ManyToManyField( > User, > limit_choices_to= {'pk__in': get_member_pks()}, > help_text="This list is limited to people accepted in > a workshop or staff. ", > filter_interface=models.HORIZONTAL, > ) > pub_date = models.DateField('Published Date') > title = models.CharField(blank=False, max_length=255) > directory = models.TextField( > 'Directory', > help_text="The directory where the project files live, not > including the base. This maps directly to the filesystem. Currentl > the base is " > + settings.PROJECT_STATIC_ROOT + '.', > blank=True, > choices=get_dir_choices(), > #prepopulate_from=('title','pub_date'), > ) > url = models.URLField( > help_text="Useful if the project is hosted on another > server.", > verify_exists=False, > blank=True > ) > pullquote = models.CharField(max_length=150, blank=True) > desc = models.TextField(blank=False) > public = models.BooleanField(default=False) > enable_comments = models.BooleanField(default=True) > image = models.ImageField( > help_text='A small screenshot or thumbnail that represents > this project. Typically less than 250px wide.', > upload_to='upload/projects/', > blank=True) > > class Admin: > list_display = ( '__unicode__', > 'workshop','pub_date','public',) > list_filter = ['workshop'] > js = ( > '/admin/media/js/getElementsBySelector.js', > '/admin/media/filebrowser/js/AddFileBrowser.js', >
Re: Value Error after update to latest Django
> > Searching here: > > http://code.djangoproject.com/search > > for date_heirarchy brings up an open ticket: > > http://code.djangoproject.com/ticket/7199 > > So looks like someone else has hit this and reported it already. The report > includes some analysis of where the error is occurring but no patch, and > apparently no on else has had a chance to look at this yet (since the ticket > is still in Unreviewed state). If you want to help the process along you > could try your hand at coming up with a patch to fix the error. > > Karen Thanks for pointing out the bug report. The original poster of the bug report seems to have narrowed down the problem. I will see what I can do to fix it. Thanks, Steve --~--~-~--~~~---~--~~ 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: Value Error after update to latest Django
On Jun 13, 7:47 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > I just updated the the latest version of Django and I started getting > the following error in the admin interface: > > Caught an exception while rendering: invalid literal for int() with > base 10: 'None' > > It seems to be the result of a model I have with a DateTimeField with > both null and blank set to True, and a date_hierarchy set on the same > field. > > Here is an example model that can re-produce the error: > > class Post(models.Model): > title = models.CharField(max_length=100) > publish_date = models.DateTimeField(null=True, blank=True) > > def __unicode__(self): > return unicode(self.title) > > class Admin: > date_hierarchy = 'publish_date' > > If I revert to a version of Django from before the qs-rf merge the > error goes away. > > I have looked through the Backwards Incompatible changes and can't > seem to find anything that would explain it. > > Is there some sort of work-around, or is this a bug? > > Thanks, > > Steven I realized that I left a few things out when describing the problem. The error occurs when trying to access the change_list portion of the admin interface after a record has been inserted with a null date. Here is more details on the error produced: Template error In template c:\python25\lib\site-packages\django\contrib\admin \templates\admin\change_list.html, error at line 16 Caught an exception while rendering: invalid literal for int() with base 10: 'None' 6 {% block coltype %}flex{% endblock %} 7 {% block content %} 8 9 {% block object-tools %} 10 {% if has_add_permission %} 11 {% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %} 12 {% endif %} 13 {% endblock %} 14 15 {% block search %}{% search_form cl %}{% endblock %} 16 {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %} 17 {% block filters %}{% filters cl %}{% endblock %} 18 {% block result_list %}{% result_list cl %}{% endblock %} 19 {% block pagination %}{% pagination cl %}{% endblock %} 20 21 22 {% endblock %} 23 So the error is a result of the null dated being processed by the date_hierarchy tag. Any ideas? Thanks, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Value Error after update to latest Django
I just updated the the latest version of Django and I started getting the following error in the admin interface: Caught an exception while rendering: invalid literal for int() with base 10: 'None' It seems to be the result of a model I have with a DateTimeField with both null and blank set to True, and a date_hierarchy set on the same field. Here is an example model that can re-produce the error: class Post(models.Model): title = models.CharField(max_length=100) publish_date = models.DateTimeField(null=True, blank=True) def __unicode__(self): return unicode(self.title) class Admin: date_hierarchy = 'publish_date' If I revert to a version of Django from before the qs-rf merge the error goes away. I have looked through the Backwards Incompatible changes and can't seem to find anything that would explain it. Is there some sort of work-around, or is this a bug? Thanks, Steven --~--~-~--~~~---~--~~ 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: Eliminating DRY violations in urlpatterns
On Apr 7, 11:08 am, bobhaugen <[EMAIL PROTECTED]> wrote: > My view that creates a new order ends with this statement: > return HttpResponseRedirect('%s/%s/' >% ('order', new_order.id)) You should be able to just place a slash in front of your redirect statement so it looks like this: return HttpResponseRedirect('/%s/%s/' % ('order', new_order.id)) > > The 'order' URL fragment is appended to the orderentry form URL like > so: > (first url)http://127.0.0.1:8000/orderentry/order/4/ > > You can get to the same 'order' view using more direct paths, > resulting in a nicer URL like: > (second url)http://127.0.0.1:8000/order/4/ > > The result of all the above is that I needed two different urlpattern > members, like so: > urlpatterns = patterns('', > url(r'^order/(?P\d+)/$', order), > url(r'^orderentry/order/(?P\d+)/$', order), > ) > > What (if anything) am I doing wrong here? How can I get the first URL > to be like the second one? Steve --~--~-~--~~~---~--~~ 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: Multiple form instances in context (newforms)
I did run across that post, at it does give some valuable information. However, I am still having a little bit of an issue figuring out how to handle the instance creation. The biggest thing is that I am using generic views and I am passing a large queryset Site.objects.all() and the generic view is taking care of pagination etc to reduce the queryset the a manageable size. Is it possible for the view to call a model method to create the form instance. Maybe I am making this way to complicated Steve On Mar 3, 9:04 pm, Michael <[EMAIL PROTECTED]> wrote: > This blog post recently really helped me out with figuring this > out:http://collingrady.com/2008/02/18/editing-multiple-objects-in-django-... > > It actually is amazingly simple once you get what is going on. > > On Mon, Mar 3, 2008 at 5:23 PM, Steve Potter <[EMAIL PROTECTED]> wrote: > > > I am in the process of building a replacement admin change_list for > > one of my models. My goal is to allow some of the more common fields > > to be edited on the change_list page as opposed to having to click on > > each individual to make changes. > > > So, I have a basic model: > > > class Site(models.Model): > > name = models.CharField(max_length=100) > > url = models.URLField(null=True, blank=True) > > category = models.ForeignKey(Category, null=True, blank=True) > > notes = models.TextField(null=True, blank=True) > > > and I have created a basic form with the fields I would like to be > > able to edit on the change_list page: > > > class SiteChangeListForm(ModelForm): > > class Meta: > > model = Site > > fields = ('category', 'notes') > > > so I know that I can create an instance with the appropriate default > > values by doing something like this: > > siteobject = Site.objects.get(pk=1) > > form = SiteChangeListForm(instance=siteobject) > > > Then I could include that instance in my context. > > > However, I am using the object_list generic view and I would like a > > form instance with appropriately populated for each object. So I can > > do something like this: > > > {{ for site in object_list }} > > > Category: {{ site.form.category }} > > Notes: {{ site.form.category }} > > > {{ endfor }} > > > I guess I am just at a loss as to how I would create the appropriate > > instances of the form and make them available in the context. Any > > help would be appreciated. > > > Thanks, > > > Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple form instances in context (newforms)
I am in the process of building a replacement admin change_list for one of my models. My goal is to allow some of the more common fields to be edited on the change_list page as opposed to having to click on each individual to make changes. So, I have a basic model: class Site(models.Model): name = models.CharField(max_length=100) url = models.URLField(null=True, blank=True) category = models.ForeignKey(Category, null=True, blank=True) notes = models.TextField(null=True, blank=True) and I have created a basic form with the fields I would like to be able to edit on the change_list page: class SiteChangeListForm(ModelForm): class Meta: model = Site fields = ('category', 'notes') so I know that I can create an instance with the appropriate default values by doing something like this: siteobject = Site.objects.get(pk=1) form = SiteChangeListForm(instance=siteobject) Then I could include that instance in my context. However, I am using the object_list generic view and I would like a form instance with appropriately populated for each object. So I can do something like this: {{ for site in object_list }} Category: {{ site.form.category }} Notes: {{ site.form.category }} {{ endfor }} I guess I am just at a loss as to how I would create the appropriate instances of the form and make them available in the context. Any help would be appreciated. Thanks, Steve --~--~-~--~~~---~--~~ 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: How to integrate with admin?
Take a look at chapter 17 of the django book http://www.djangobook.com/en/1.0/chapter17/ it covers exactly this. Steve On Mar 2, 1:53 pm, NoiZe <[EMAIL PROTECTED]> wrote: > Hi! > > I'm building an e-commerce site in Django and wonder how to add > functionality to the admin? Is it just like developing the public site > with views and controllers? > > Thanks a lot for helping out a noob :) --~--~-~--~~~---~--~~ 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: check for request.META keys
On Nov 16, 12:01 am, Matt McClanahan <[EMAIL PROTECTED]> wrote: > On Nov 15, 8:51 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > > > It just seem that there should be a better way of doing this. I was > > thinking about a method that would perform the test for me and return > > either the contents or a blank string. > > Often times, when it seems like something should exist, it's useful to > operate on the assumption that it does, and go looking for it. In > this case, request.META is a glorified dictionary, and dictionaries > have a get() method:http://docs.python.org/lib/typesmapping.html > > So you can use request.META.get('somekey', 'defaultvalue') > > Matt Thanks Matt, for pointing out the obvious. Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
check for request.META keys
I'm working on a project that involves logging large amounts of information about each visitor to the site. I understand that the contents of request.META cannot be depended upon, but I would like to log things like REMOTE_ADDR and HTTP_REFERER. I am finding myself writing a lot of code that looks like this: if 'REMOTE_ADDR' in request.META: remote_address = request.META['REMOTE_ADDR'] else: remote_address = '' to avoid KeyError exceptions later on. It just seem that there should be a better way of doing this. I was thinking about a method that would perform the test for me and return either the contents or a blank string. Anyone have better ideas? Thanks, Steven Potter --~--~-~--~~~---~--~~ 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: Getting image field in a template
On Oct 24, 1:35 am, Page <[EMAIL PROTECTED]> wrote: > I'm new to Django and Python but trying to catch on. I have an image > model for a portfolio page. I also have a model for the portfolio > information for that page. > > After creating a template for the portfolio item detail page I can > pull in of the fields by simply including a template tag like > {{ object.size }} and it pulls all of them in. > > But I cannot for the life of me get the image to work. The image class > is named PortfolioImage and I have tried endless variation of > {{ image.PortfolioImage }} etc using object and everything else I > came accross. The app is named portfolio so I've tried > portfolio.PortfolioImage and endless combinations as well. > > I've looked at the documentation in the Admin section of the site and > it has information on the models and the fields available and has > image available, I just can't seem to get it to pull in the URL into > the tag in the template. > > Am I just missing some Python context somewhere or is there something > I need to do to make the image available in my template. > > Any help greatly appreciated. The fact that you are using {{ object.size }} makes me think that you are using generic views. If this is the case you should be able to use {{ object.imagefieldname }} where imagefieldname is the name that you used in your models.py If you are not using generic views I would need to see the relevant sections of your models.py and views.py to tell you what you need. Steve --~--~-~--~~~---~--~~ 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: Custom middleware for logging
On Oct 19, 8:43 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 10/19/07, Steve Potter <[EMAIL PROTECTED]> wrote: > > > > > I would like to put together a piece of code that will test the > > referer for each request and if it matches a predefined pattern it > > would log that request as well as place a cookie on the client. > > > Is custom middleware the correct place to do this? > > Yes. It sounds like you want to use process_request, do your > matching, and either log right then, or, if you need to wait for the > response for some reason, annotate the request with an extra > attribute, which a later process_* can check for. > > > Also, I'm not exactly clear how response.set_cookie() works. If I set > > a cookie in the middleware during a request, will it be passed to the > > client on the next response? > > Use response.set_cookie in process_response. That's always the > response passed back from the resolved view. The cookie will be set > on *that* response, which is going on the wire back to the client just > after you return. :) Thanks for the clarification. Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom middleware for logging
I would like to put together a piece of code that will test the referer for each request and if it matches a predefined pattern it would log that request as well as place a cookie on the client. Is custom middleware the correct place to do this? Also, I'm not exactly clear how response.set_cookie() works. If I set a cookie in the middleware during a request, will it be passed to the client on the next response? Thanks, Steve --~--~-~--~~~---~--~~ 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: pagination documentation unclear
On Oct 11, 5:43 pm, johnny <[EMAIL PROTECTED]> wrote: > I was going over documentation on pagination and it mentions you can > do it in two ways as follows: > > URL... ?page=x > or > (r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict)) > > My question is, you would use > > "URL... ?page=x" for regular views? > > "(r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict))" > for generic views? > > object_list is the function in django.views.generic.list_detail ? > > What is dict(info_dict) do? > > what is objects in "(r'^objects/page(?P[0-9]+)/$'", model name? Johnny, This example is just trying to demonstrate that you can either paginate urls by using http://www.example.com/somepage/?page=2, or you can use something like http://www.example.com/somepage/2/ neither one is restricted to custom or generic views it is all about how you configure your urls.py. Steve --~--~-~--~~~---~--~~ 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: upload_to dir in ImageField
On Oct 5, 6:45 pm, Andy <[EMAIL PROTECTED]> wrote: > I'm having some trouble with the object.get__url() results > for my image field. I'm trying to get this going with the Django's > (ver 0.95) development server in WinXP. I have the following line in > my model: > > avatar = models.ImageField(upload_to='users/', blank=True, null=True) > > I have the following in my settings.py: > > MEDIA_URL = '/media/images/' > > When I call object.get_avatar_url in either a view or a template it > returns the following URL: > > /media/images/image.jpg > > It's missing the 'upload_to' directory, it should be this: > > /media/images/users/image.jpg > > According to the FileField documentation it is supposed to append the > upload_to dir to the end of the MEDIA_URL, but it's not doing that. > I've tried a lot of variations of beginning/ending slashes but it > doesn't help. Am I missing something obvious here? Should it work as > intended on the dev server? > > Thanks in advance. The question is, does it upload the file to the appropriate place? Personally when I specify an upload_to path I omit the beginning and end slashes. Also, I believe the upload_to path is only appended at the time of upload. So, if you already had the aforementioned entry in the database before you set the upload_to path you may get the result you are seeing. Steve Potter --~--~-~--~~~---~--~~ 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: Templates for Custom Template Tags
I was misunderstanding where the app_directories loader looks for files. It makes sense now. Thanks, Steve On Sep 30, 3:58 pm, AndrewK <[EMAIL PROTECTED]> wrote: > You need to place your tag templates into the subdirectory called > "templates" of your application directory. > In that case > django.template.loaders.app_directories.load_template_source would be > able to found your custom tag template. And you don't need to add this > directory's path to TEMPLATE_DIRS variable. > > On Sep 30, 1:17 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > > > I created a custom inclusion tag that makes use of a template file > > named menu_tag.html. I placed that file in the app's subdirectory of > > the template directory. > > > When I tried to make use of it I got a template does not exist > > error. > > > I was able to resolve this by adding the app's subdirectory to the > > TEMPLATE_DIRS path. > > > However, it was my understanding that as long as > > django.template.loaders.app_directories.load_template_source was > > included in the TEMPLATE_LOADERS (which it is), Django would > > automatically look in the subdirectories of the installed apps. This > > functionality seems to be working for other template files, just not > > the ones from my custom tag. > > > Is it possible that this is because I placed the custom tag in the > > base.html that was in the root template directory rather that used in > > one of the app's template files? > > > Any clarification would be great. > > > Thanks, > > > Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Templates for Custom Template Tags
I created a custom inclusion tag that makes use of a template file named menu_tag.html. I placed that file in the app's subdirectory of the template directory. When I tried to make use of it I got a template does not exist error. I was able to resolve this by adding the app's subdirectory to the TEMPLATE_DIRS path. However, it was my understanding that as long as django.template.loaders.app_directories.load_template_source was included in the TEMPLATE_LOADERS (which it is), Django would automatically look in the subdirectories of the installed apps. This functionality seems to be working for other template files, just not the ones from my custom tag. Is it possible that this is because I placed the custom tag in the base.html that was in the root template directory rather that used in one of the app's template files? Any clarification would be great. Thanks, Steve --~--~-~--~~~---~--~~ 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: Help with httpd.conf for mod_wsgi and media directory
On Sep 29, 6:58 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > What version of Apache are you using? The ordering or rule evaluation > in Apache 1.3 is actually based on order of LoadModule/AddModule lines > in Apache configuration as at code level can't define the ordering > dependencies between modules. > > BTW, if you comment out the WSGIScriptAlias directive, can you then > access the images, ie., can Apache actually read the directory and see > the files? > > Graham > Graham, Thank you very much. I was looking all over for that little nugget of information. I simply moved the AddModule mod_wsgi.c line to before the one for mod_alias. BTW, this might be worth mentioning on the mod_wsgi site. Thanks again, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help with httpd.conf for mod_wsgi and media directory
Below is the httpd.conf virtual host directive I created based on the directions from the mod_wsgi website. Everything is working fine with mod_wsgi and Django. The problem I am having is with the media directory (I would like it to be /images/). It appears that the line with Alias /images/ is being overridden by the line with WSGIScriptAlias /. Is this the expected result? My understanding from the mod_wsgi site was that if the Alias /images/ line was placed first, it would take precedence. I also tried moving it to after the WSGIScriptAlias line, but it made no difference. Any ideas? Thanks, Steve ServerAlias www.missedventures.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/missed/public_html ServerName missedventures.com User missed Group missed BytesLog /usr/local/apache/domlogs/missedventures.com-bytes_log CustomLog /usr/local/apache/domlogs/missedventures.com combined ScriptAlias /cgi-bin/ /home/missed/public_html/cgi-bin/ Alias /images/ /home/missed/django/projectsmt/images/ Order deny,allow Allow from all WSGIScriptAlias / /home/missed/django/projectsmt/pjsmt.wsgi Order deny,allow Allow from all --~--~-~--~~~---~--~~ 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: Deployment issues: ViewDoesNotExist error
On Sep 26, 10:02 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 9/26/07, Steve Potter <[EMAIL PROTECTED]> wrote: > > > user = models.ForeignKey(auth.models.User) > > > It appears that the django.contrib.auth is missing the models > > attribute. > > No, it's not. Most likely there's a bad import statement in your > models file, or no import statement, or you've got two things both > trying to import a module named 'auth' and the other one is "winning". > > The best practice for your case is to have this at the top of your models > file: > > from django.contrib.auth.models import User > > and to write the foreign key like so: > > user = models.ForeignKey(User) > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." Well, I'm not sure what is different, but if I do the following: cd /home/missed/django/projectsmt/ python manage.py shell >>> import django.contrib.auth as auth >>> print auth.models As expected However, if I mimic the wsgi script as follows: cd /home/missed/django/projectsmt/ python >>> import os, sys >>> sys.path.insert(0, '/home/missed/django') >>> sys.path.insert(0, '/home/missed/django/projectsmt') >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'projectsmt.settings' >>> import django.contrib.auth as auth >>> print auth.models Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'models' Am I missing something required in the environment when I do it manually? Thanks, Steve --~--~-~--~~~---~--~~ 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: Deployment issues: ViewDoesNotExist error
On Sep 26, 9:36 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 9/26/07, Steve Potter <[EMAIL PROTECTED]> wrote: > > > ViewDoesNotExist: Tried index in module projectsmt.imglog.views. Error > > was: 'module' object has no attribute 'models' > > Something in your views module is trying to import from a 'models' > module that either doesn't exist, or isn't where your import statement > says it should be. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." I think I have tracked it down to the following line in my models.py file user = models.ForeignKey(auth.models.User) It appears that the django.contrib.auth is missing the models attribute. Has something changed in django-trunk recently? BTW, how do I check what version of django I am running? Thanks, Steve Potter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Deployment issues: ViewDoesNotExist error
I have been working on trying to deploy a simple app that I created and works fine with the development server. Deployed it using apache and mod_wsgi. After working through a few initial permissions issues I am left with the following error: ViewDoesNotExist: Tried index in module projectsmt.imglog.views. Error was: 'module' object has no attribute 'models' You can see the entire traceback of the error at http://www.missedventures.com/imglog/ I am at a complete loss, does anyone have any ideas? Thanks, Steven Potter --~--~-~--~~~---~--~~ 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: Strange error, trying to deploy Django with mod_wsgi
On Sep 25, 8:27 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Sep 26, 3:59 am, Steve Potter <[EMAIL PROTECTED]> wrote: > > > > > > This sort of odd error can sometimes come up if you have chosen names > > > for directories/modules which clash with standard Python module names. > > > > Where you have in your WSGI script file for mod_wsgi something like: > > > > sys.path.append('/usr/local/django') > > > sys.path.append('/usr/local/django/mysite') > > > > change it to: > > > > sys.path.insert(0, '/usr/local/django') > > > sys.path.insert(0, '/usr/local/django/mysite') > > > > This will ensure that your site directories are first in the path > > > before any of the standard Python modules directory and if you have > > > used a name which is the same as some standard module, your module > > > will take precedence. > > > > Other than that, would need to see the full error and traceback and if > > > related to something in urls.py, show the contents of your rules as > > > well so can see what target modules/properties are. > > > > Graham > > > Graham, > > > I tried changing the paths as you mentioned above, but nothing > > changed. You can see the full traceback > > at:http://www.missedventures.com/imglog/ > > What does your urls.py file contain though. > > BTW, this is more looking like debugging something related to how > Django works rather than it being a mod_wsgi issue. Possibly how > Django deals with something in urls.py differs slightly between > development server and when run under Apache. Based on past list > conversations, this sometimes occur where trailing slashes haven't > been used consistently in the way they should. > > Anyway, this is getting beyond my knowledge of Django. If you post the > urls.py file, someone else might perhaps see something in there which > is unconventional. > > Graham Graham, Thanks for your help with the other problems. I think I will start another thread specific to this problem (with a little more appropriate subject). Thanks again, Steve Potter --~--~-~--~~~---~--~~ 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: Strange error, trying to deploy Django with mod_wsgi
> > This sort of odd error can sometimes come up if you have chosen names > for directories/modules which clash with standard Python module names. > > Where you have in your WSGI script file for mod_wsgi something like: > > sys.path.append('/usr/local/django') > sys.path.append('/usr/local/django/mysite') > > change it to: > > sys.path.insert(0, '/usr/local/django') > sys.path.insert(0, '/usr/local/django/mysite') > > This will ensure that your site directories are first in the path > before any of the standard Python modules directory and if you have > used a name which is the same as some standard module, your module > will take precedence. > > Other than that, would need to see the full error and traceback and if > related to something in urls.py, show the contents of your rules as > well so can see what target modules/properties are. > > Graham Graham, I tried changing the paths as you mentioned above, but nothing changed. You can see the full traceback at: http://www.missedventures.com/imglog/ Thanks, Steven --~--~-~--~~~---~--~~ 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: Strange error, trying to deploy Django with mod_wsgi
On Sep 24, 6:16 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > Are you sure that the user Apache is running as has permissions > > to read directories/files under the missed user's home dir?. > > The permissions issues along with other common issues are described > in: > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues > > What you might do if permissions is an issue is use mod_wsgi daemon > mode to delegate your Django instance to a separate daemon process > that runs as you rather than the default Apache user. > > Graham Thanks, That took care of the error I was receiving, as well as a few subsequent ones. Now I am stuck with another one. I am able to load the admin properly, but when I try to access my app I get the following error: ViewDoesNotExist at /imglog/ Tried index in module projectsmt.imglog.views. Error was: 'module' object has no attribute 'models' But the view does exist and works properly with the development server. After looking through the archives, I thought I was running up against a path problem. However I added both the project directory as well as its parent directory to the PythonPath. Still no luck...So then I decided that I still had a permissions issue, but I went as far as moving the project into /var/django and setting all of the permissions to 777 and I still get the error. I am at a complete loss, what is the above error referring to when it says 'module' object? I looked through the view.py file for my app, and the only occurrence to the word 'models' I could find was in an import statement. Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Strange error, trying to deploy Django with mod_wsgi
I am in the process of trying to deploy a Django site using mod_wsgi. I had no problems installing mod_wsgi. However I did run into a few problems when trying to set the site. The first thing I ran into is that i forgot to install Mysql-python. So, I downloaded the source and did the following: tar -zxvf Mysql-python.tar.gz No problems there python setup.py build I did get some message about needing setuptools, but it automatically took care of that. The build went successfully with no errors. sudo python setup.py install Again everything seemed to go just fine with no errors. But when I tried to load the site I still received a 500 error and the apache error log had the following: mod_wsgi (pid=5070): Exception occurred within WSGI script '/home/ missed/projectsmt/pjsmt.wsgi'. Traceback (most recent call last): File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ wsgi.py", line 197, in __call__ response = self.get_response(request) File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ base.py", line 53, in get_response response = self._real_get_response(request) File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ base.py", line 63, in _real_get_response response = middleware_method(request) File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/ middleware.py", line 13, in process_request engine = __import__(settings.SESSION_ENGINE, {}, {}, ['']) File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/ backends/db.py", line 2, in from django.contrib.sessions.models import Session File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/ models.py", line 3, in from django.db import models File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py", line 17, in backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, {}, ['']) File "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/ base.py", line 9, in import MySQLdb as Database File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in File "build/bdist.linux-i686/egg/_mysql.py", line 7, in File "build/bdist.linux-i686/egg/_mysql.py", line 3, in __bootstrap__ File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5- py2.5.egg/pkg_resources.py", line 2470, in File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5- py2.5.egg/pkg_resources.py", line 343, in __init__ File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5- py2.5.egg/pkg_resources.py", line 358, in add_entry File "/usr/local/lib/python2.5/site-packages/setuptools-0.6c5- py2.5.egg/pkg_resources.py", line 1577, in find_on_path OSError: [Errno 13] Permission denied: '/home/missed' The permission denied error doesn't make much sense, obviously it is able to read the project files, or it wouldn't get this far. Also, I don't know what all the errors about setuptools are, that doesn't seem to make any sense either. It seems to me that I am still having problems with the Mysql-python install, but being the install went smoothly, I don't know where I should be looking. Any ideas? Thanks, Steven Potter --~--~-~--~~~---~--~~ 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: Django deployment options
> > Django can be run fine under Apache 1.3 using mod_wsgi. > > The only issue is whether they do really allow you to add additional > Apache modules to the installation. > > Graham This is interesting... It is possible to install additional modules with cpanel, it just makes updating for new releases of Apache a little more complicated. Do you know where I might find any more information about installing Django with mod_wsgi? Thanks Steven Potter --~--~-~--~~~---~--~~ 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: Django deployment options
> > 5. Use a different server. > > Unless you are on what cPanel calls the bleeding edge, you're running > Apache 1.3 which is useless for serving Django. That leaves you with > either #3 or #4. #3 has issues because cPanel wants to bind Apache to > all IP addresses. I had issues (though I didn't troubleshoot them > throuroughly) with changing httpd.conf to only attach to specific IPs. > #4 is inefficient and a pain to maintain. I'm moving all my Django > apps to Slicehost because the cPanel setup is so ugly. > Cpanel has actually released Apache 2.0 and 2.2 on Current, and will be following shortly with Release and stable. So I suspect that there will be a growing number of requests to integrate Django with a Cpanel managed server. I know that Cpanel can cause some problems trying to bind Apache to all of the IP addresses, but I believe it is possible to override that behavior. So if I decide to go with option 4 and install a second http server, what is the advantage of lighttpd over a second copy of Apache? Thanks, Steven Potter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django deployment options
I currently have a dedicated server running a Cpanel installation with several virtual hosts. I would like to install Django on this server and as far as I can tell, I have several options. 1. Add mod_python to existing Apache installation 2. Add FastCGI to existing Apache installation 3. Install secondary server (another installation of apache lighttpd, etc..) bound to another ip address for Django 4. Same as above, but instead of a different ip address use localhost and install mod_proxy on existing Apache. I'm already quite sure I don't want to install mod_python on the existing Apache after reading all of the warnings about using the same Apache to serve static documents and Django. I am interested in pros and cons of the different options as well as any options I may have missed. I would also like to know what others have tried. Thanks, Steven Potter --~--~-~--~~~---~--~~ 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: Integrating Django with existing site.
On Sep 5, 11:31 am, "Dorai Thodla" <[EMAIL PROTECTED]> wrote: > Steve, > This is a great idea that may work as a migration strategy from lot of other > portals/content management systems or even websites. I wonder whether there > is some wikispace where we can preserve migration strategies. > > Doraiwww.thodla.com I'm sure I could put together a quick doc. However, before I do that I am going to try some of these ideas and see if I can't put together a few code examples, and more detailed instructions. Steve --~--~-~--~~~---~--~~ 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: Integrating Django with existing site.
> > Try coding each module as a Django template tag. > Then, create a template that returns an html fragment rather than a > full html page. > Associate each rendered template with a specific URL. > Perhaps something like: > mysite.com/components/module1.html > In Joomla, create a plug-in that simply calls the component. > > As you migrate away from Joomla to Django, simply use the template > tag directly in your Django template so you don't need to make the > extra call. > --Ray Ray, That sounds like it work work. The only thing I am having a hard time understanding is how the request is made from the php script to Django. Would it be best to make the request to the localhost using something like CURL? Thanks, Steve --~--~-~--~~~---~--~~ 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: Integrating Django with existing site.
> > You can use url rewriting to point your users at the old site while you > code up the new one. Apache's mod_rewrite is pretty well documented. > You would capture incoming URLs that aren't yet in your new Django app > before they get to it, sending them to the legacy app instead. > > http://httpd.apache.org/docs/2.2/mod/mod_rewrite.htmlhttp://howto.kryl.info/mod_rewrite/ > > -- > Greg Donald > Cyberfusion Consultinghttp://cyberfusionconsulting.com/ That might work for some of the situations, but most pages on the site consist of several "modules". Think of it like iGoogle.com you have many different modules, each of them being a separate application that functions independently of the others, but they are all displayed on one page. I want to be able to convert these modules one by one without having to replace the underlying Joomla system until I have finished converting all of the modules. Thanks, Steve Potter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Integrating Django with existing site.
I have an existing website currently built with Joomla. I would like to convert it to a custom designed Django site. The problem I am running into is that I will not be able to do it all at once. To start with, I would like to take some of the business logic and form process and move to Django, but continue to use Joomla to serve the content. It seems that it should be possible to do something like this by creating a custom component for Joomla that acts as a proxy. I'm just looking for some pointers. Has anyone else tried something like this? Is it possible to send requests to Django without using the URL system? Thanks, Steve Potter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---