looking for an app to view various github repositories within a django powered site
I'm looking to build a website to collaborate on some open source projects. I'd like to set up discussions based on git repositories, and maybe even allow folks to contribute/fork/submit issues, etc. I could handle this on my own, but its more of a side fun project for myself and I'd rather see if there is something already completed, or mostly completed. thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oXLGdJjhi8EJ. 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.
get all objects that are related to current, reverse look up
simply put, here's my code class ContentBlock(Orderable, Displayable): location = models.ManyToManyField(ContentBlockLocation, blank=True, null=True, help_text="list of locations to display content block") page = models.ManyToManyField(Page, blank=True, null=True, help_text="list of pages to display content block") height = models.IntegerField(blank=True, null=True) width = models.IntegerField(blank=True, null=True) def __unicode__(self): return self.title class StaticContent(Displayable, RichText): content_block = models.ForeignKey(ContentBlock, blank=True, null=True) class StaticContent2(Displayable, RichText): content_block = models.ForeignKey(ContentBlock, blank=True, null=True) putting together a template tag that will return all the items associated with a given ContentBlock, but i would like to do so without knowing upfront all of the classes that have a foreign key to ContentBlock as i'll want to be able to add more content types at any time -- 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: Sidebars
This sounds like too much work, every time you want a new option in the sidebar you're adding another if, right? I'm planning on building a template tag to handle side content like that. I am using mezzanine as my base so i have the luxury of having every url resolve to their Page model. So i'm going to be using a onetomany field (i think) to assign content to pages as well as a section (sidebar_left , sidebar_right, etc) In the main template all i'm going to have to do is {% sidebar_left page.id %} pass page.id through to the function and return all of the content that has a key to that page.id. there will be more to it, such as figuring out which model the content belongs to in order to send the data to the correct template to render it with On Jun 27, 7:54 am, "Cal Leeming [Simplicity Media Ltd]"wrote: > Can I just clarify what you mean by sidebar? > > I assume you are talking about a html element with some options inside it, > to allow you to navigate through the site? > > This is (personally) how I'd do it, although others may prefer a different > style (you could probably go as far to make this whole thing "classy"). > > (hand typed code, may need re-writing) > > --- views.py --- > page = "dashboard/help/users" > > RequestContext(request, { > 'section' : page.split("/") > > } > > --- layout.html --- > {% if section.0 = 'dashboard' %} > display stuff relating to dashboard only > {% if section.1 = 'help' %} > display stuff relating to dashboard/help only > {% endif %} > {% endif %} > > > > > > > > On Mon, Jun 27, 2011 at 6:27 AM, Venkatraman S wrote: > > Hi, > > > I was looking for possible suggestions in implementing sidebars - i have a > > truck load of screens and need the sidebar to change dynamically base don > > the view. Most of the siderbar-conten is just links. > > > I was thiking of including the various sidebar options in the base.html and > > then include a flag to check whether it has to be rendered or not; and in > > the view pass the relevant flag. > > > Any other ideas? > > > -venkat > > > -- > > 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. -- 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: how to list all model classes within admin that extends another model?
basically speaking, i want a class' admin page w/ it's list of entries listed on the client page. so, every class object that has a Client pk foreign field relationship is listed on that Client's admin page whether it is a portfolio object, an invoice object, or any future class i create that gets a foreign field relationship to Client On May 15, 8:29 pm, garagefan <monkeygar...@gmail.com> wrote: > yeah, i've changed things around just slightly and included a > tabularinline > > however, now i need to modify the template to display a link to each > of the items pages, b/c as is it only allows one to update the name of > the clientobject, which is now: > > class ClientObject(models.Model): > client = models.ForeignKey(Client) > name = models.CharField(max_length=250) > def __unicode__(self): > return self.name > > i would like each ClientObject listed to link to it's admin page. > Right now i just have the portfolio application w/ the Portfolio class > extending the ClientObjects class. Ultimately, i also wouldnt mind a > list of classes that extend the ClietObjects class to be listed w/ an > "add blahblahblah" to client link that pops open an admin popup > > On May 15, 7:42 pm, Shawn Milochik <sh...@milochik.com> wrote: > > > > > > > > > Try this: > > >http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contri... -- 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: how to list all model classes within admin that extends another model?
yeah, i've changed things around just slightly and included a tabularinline however, now i need to modify the template to display a link to each of the items pages, b/c as is it only allows one to update the name of the clientobject, which is now: class ClientObject(models.Model): client = models.ForeignKey(Client) name = models.CharField(max_length=250) def __unicode__(self): return self.name i would like each ClientObject listed to link to it's admin page. Right now i just have the portfolio application w/ the Portfolio class extending the ClientObjects class. Ultimately, i also wouldnt mind a list of classes that extend the ClietObjects class to be listed w/ an "add blahblahblah" to client link that pops open an admin popup On May 15, 7:42 pm, Shawn Milochikwrote: > Try this: > > http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contri... -- 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.
how to list all model classes within admin that extends another model?
building a client management application for myself in one application model, called client_management, i have class Client(models.Model): active = models.BooleanField(_('active client'), default=False) name = models.CharField(max_length=250) logo = models.ImageField(upload_to="logos") def __unicode__(self): return self.name class ClientObject(models.Model): class Meta: abstract = True in my portfolio app i have: class Portfolio(ClientObject): client = models.ForeignKey(Client) active = models.BooleanField(_('active portfolio'), default=False) category = models.ForeignKey(PortfolioCategory) name = models.CharField(max_length=250) within the main client_management application's Client within the admin i want to list all apps, like Portfolio, that extend ClientObject whose client foreign key is the current Client. IE: within a Client within the Client_Management in the admin i'd get a link that says "add portfolio" perhaps with a list of portfolios already added. eventually i'd like to extend this with more client applications, like invoices and notes, etc... plus unknown future applications, so i'd like it to work without anything more than creating a class that extends ClientObject -- 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: better options for hosting multiple django based websites?
i meant ScriptAlias :( how embarrassing. And no... it does not appear that i am using it in daemon mode as the only reference of wsgi in my http.conf file are those WSGIScriptAlias' within virtualhost's On Mar 14, 4:46 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Monday, March 14, 2011 4:27:19 PM UTC-4, garagefan wrote: > > > I've got a server hosting multiple websites. Currently its not a big > > deal to add another virtual host entry to apache2. Now, i'm using a > > bad habit and using an http.conf instead of learning about, and > > setting up "available sites". > > > I'm using mod_wsgi as well. > > > Now, in consideration of using "available sites" instead of the > > http.conf, i'm looking for a better option than manually creating > > entries for projects. for instance i'm using subdomains on my > > development server... project.name.website.com where all projects are > > served under my website. I'd like to set the server up in such a way > > that i don't have to add a new entry within apache to understand name > > points to a specific directory. However, the issue appears to be that > > WSGIServerAlias doesn't accept any wildcards. > > > is there a way around this? Is my question even understood? > > Are you using daemon mode of mod_wsgi? > > If you are, then there is no way as there is not currently any way to have > dynamic creation of new daemon process groups. > > If you are using embedded mode (which you really shouldn't in general), then > there are ways as WSGIScriptAlias (no such thing as WSGIServerAlias), is not > the only way of configuring Apache/mod_wsgi to map sites. > > More details of which mode you are using would need to be provided before > can comment further. > > Graham -- 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.
better options for hosting multiple django based websites?
I've got a server hosting multiple websites. Currently its not a big deal to add another virtual host entry to apache2. Now, i'm using a bad habit and using an http.conf instead of learning about, and setting up "available sites". I'm using mod_wsgi as well. Now, in consideration of using "available sites" instead of the http.conf, i'm looking for a better option than manually creating entries for projects. for instance i'm using subdomains on my development server... project.name.website.com where all projects are served under my website. I'd like to set the server up in such a way that i don't have to add a new entry within apache to understand name points to a specific directory. However, the issue appears to be that WSGIServerAlias doesn't accept any wildcards. is there a way around this? Is my question even understood? 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.
new project settings file not found
this is a first for me. i set up a project like i normally do and get things set up... run syncdb for the first time for the project. Havent had this happen before and things seem to be working on other projects just fine. I've even go so far as to comment out the handful of apps. I presume there now, is there a requirement that the apache stuff be set up to run syncdb? that is the only thing i can think of as i just set up the subdomain and http.conf for it on the server. doesn't seem to make sense to me that that would be the case though... file/directory permissions are the same as my other projects as well python manage syncdb Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/__init__.py", line 257, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/commands/syncdb.py", line 7, in from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/core/management/sql.py", line 5, in from django.contrib.contenttypes import generic File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/contrib/contenttypes/generic.py", line 6, in from django.db import connection File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/db/__init__.py", line 14, in if not settings.DATABASES: File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/conf/__init__.py", line 40, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/ django/conf/__init__.py", line 75, in __init__ raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) ImportError: Could not import settings 'blog.settings' (Is it on sys.path? Does it have syntax errors?): No module named settings -- 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: thumbnails and rackspace files
easy thumbnails certainly does a decent job of creating thumbnails. I'm not too fond of having a template tag do that though... it basically does what i'm think of doing, but in a different area. it also doesn't send the thumbnail over to cloudfiles, which is really what i'm wanting to do, and without running syncstatic. i'll take a look through easy thumbnail and see if there are any clues for me... i should just have to override it's save functionality to get what i need. thanks for cumulus! its nicer having a specific backend for this instead of one that is useful for multiples.. at this time anyway. On Jan 19, 2:56 pm, Michel Thadeu Sabchukwrote: > Hi, > > > setting up django-storages was simple... > > I recommend you to use django-cumulus [1] rather than django-storages. > The first one is a rewrite made by the same author. > > > however... on the save of my gallery application i'm creating > > thumbnails. this is easy to do with my custom field... normally. > > django-storages doesnt work so well with this. So i need to come up > > with a work around. My first thought was to grab the image from the > > CDN server, open it with PIL, crop and create the thumbnail, save it > > to my server, push it to my files server then delete the files on the > > working server. > > Do you know django easy-thumbnails [2]? I think it will fit your > needs. > > Feel free to contact me on private to share rackspace cloudfiles > specific experiences ;) > > Best regards. > > [1]https://github.com/richleland/django-cumulus > [2]https://github.com/SmileyChris/easy-thumbnails > > -- > Michel Sabchuk -- 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.
thumbnails and rackspace files
setting up django-storages was simple... using rackspace's python API to send an image to my container... met with some troubles (broken pipe error on code that worked). however... on the save of my gallery application i'm creating thumbnails. this is easy to do with my custom field... normally. django-storages doesnt work so well with this. So i need to come up with a work around. My first thought was to grab the image from the CDN server, open it with PIL, crop and create the thumbnail, save it to my server, push it to my files server then delete the files on the working server. this seems like a lot of processes to be running and there has got to be a simpler way. and my idea on injecting this code would be into a signal, pre save, assuming that the file is written to the files server prior to the item being saved. currently i have a custom field extending the ImageField w/ an attr_class that extends the ImageFieldFile. I'd prefer to run everything in the attr_class if possible and would prefer to stay away from grabbing the image from the public url and do modify the image and create the thumbnail along the way. i suppose i could go the simple route and and use css to alter the main image. -- 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: image servers?
wow, this supports rackspace's cloud files already so i'll definitely be taking a gander. On Jan 11, 12:25 pm, Eric Chamberlain <e...@rf.com> wrote: > You might want to look at django-storages > <https://bitbucket.org/david/django-storages/wiki/Home>. We use it with S3. > > On Jan 10, 2011, at 4:55 PM, garagefan wrote: > > > > > > > > > > > so i bit the hype and got myself a rackspace cloud account. i also got > > a rackspace file account for image serving. i would like to write > > something that overrides where all images are saved, regardless of the > > model that requests the save. > > > what would this be? would i make this a middleware? I assume i need to > > extend and "replace" the default "save file to MEDIA_ROOT directory" > > > i havent had to extend or replace django's default behavior, so before > > i start digging in to this, i need to know the best place for this... > > which, i assume would be middleware. yes? > > > 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-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. > > -- > Eric Chamberlain, Founder > RF.com -http://RF.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-us...@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: image servers?
Rackspace has an API for connecting to the server and writing to it... I'll see if the ability to mount it is there as that would be... amazing On Jan 10, 10:59 pm, Dustin <dustin.far...@gmail.com> wrote: > I haven't used Rackspace, but i would assume (hope) they support > remote mounting. > > I would use sshfs to mount the Rackspace server on your local drive > (on the Django server) and reference that in MEDIA_ROOT > > e.g. > > sshfs usern...@my.rackspace.domain:/path/to/rackspace/home/dir /mnt/ > rackspace > > change MEDIA_ROOT to > > MEDIA_ROOT = '/mnt/rackspace/' > > and MEDIA_URL > > MEDIA_URL = 'my.rackspace.domain' > > On Jan 10, 6:55 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > > > > > so i bit the hype and got myself a rackspace cloud account. i also got > > a rackspace file account for image serving. i would like to write > > something that overrides where all images are saved, regardless of the > > model that requests the save. > > > what would this be? would i make this a middleware? I assume i need to > > extend and "replace" the default "save file to MEDIA_ROOT directory" > > > i havent had to extend or replace django's default behavior, so before > > i start digging in to this, i need to know the best place for this... > > which, i assume would be middleware. yes? > > > 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-us...@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.
image servers?
so i bit the hype and got myself a rackspace cloud account. i also got a rackspace file account for image serving. i would like to write something that overrides where all images are saved, regardless of the model that requests the save. what would this be? would i make this a middleware? I assume i need to extend and "replace" the default "save file to MEDIA_ROOT directory" i havent had to extend or replace django's default behavior, so before i start digging in to this, i need to know the best place for this... which, i assume would be middleware. yes? 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-us...@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: How to get a web development job (i.e. Django/Python) if someone is an amateur programmer?
I was once in your shoes. No real resume experience to show... no sites to display my knowledge. My advice... makes more friends. It's all in who you know. Met some at an intro html course at a community college, ended up being good friends. He was a developer already, but a few years later he tells me about a company he got placed at and said I could easily do the work... then he helped me get an interview, then I got hired... knowing basic stuff. Moral of the story, network On Dec 17, 12:03 pm, Dopsterwrote: > *This is a question that can be generalized for any other amateur > programmers looking to get into software development, and specifically > startups. I specify Django/Python in my own details below, but it can be > replaced with PHP, Ruby, etc.* > > As an amateur, how could I position myself to get in the door at an > established startup (i.e., not founding team) or web dev shop as a junior > Django/[insert language/framework here] developer? What could I do that > would give me a chance of getting a job? My guess is that actually building > something is the right way to go about this? > > Build a really simple web app? Build a web resume? Start a technical blog? > Contribute to open source? (though as an amateur, making meaningful > contributions is unlikely...) > -- > > My own personal details, as to define what I mean by "amateur": > > Academic CS knowledge: > > - Non-CS degree > - Two Java courses in college as a non-CS engineer (4+ years ago), which > I admittedly have since forgotten, but helped me establish... > - Comfort with basic CS elements (i.e., classes, functions, basic data > structures, control flow tools, etc.) > > Practical experience (from a failed startup and work): > > - 1 year of HTML/CSS/JS > - 1 year of PHP > - 3 years of SQL (mySQL, Oracle, MS Access) > - 2 years of VBA development in Excel/Access (front-end and back-end) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: signal locations
That wouldn't resolve the problem any more than having everything in the models.py. i wish to externalize this signal from the gallery application so that it is up to the website project whether or not a signal is being used. i suppose i could add a toggle variable in the gallery settings file so the project settings file can decide whether or not to utilize the work being done within the method via a local variable... seems kind of a messy way to do things... it'd be great to have a single file for the website's signals... sort of like setting up templatetags at the project level On Dec 1, 3:28 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Dec 1, 5:29 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > > > > > > > Now, i've read the thread in regards to putting the import in the > > __init__.py > > > here is my structure > > > website_project > > - > signals > > - - > signals.py (and an __init__.py) > > - > shared_apps (link to numerous apps shared amongst other projects) > > - - > gallery application > > > my signals.py looks like this > > > from django.db.models.signals import post_save > > from django.core.mail import send_mail > > from gallery.models import Gallery > > > def send_creation(sender, instance, *args, **kwargs): > > if 'created' in kwargs: > > if kwargs['created'] and instance.published: > > send_mail('Subject here',[sender, instance.published, > > args, kwargs,], 'f...@example.com', ['@example.com'], > > fail_silently=False) > > > post_save.connect(send_creation,sender=Gallery) > > > this works when in the gallery application, however... this is just a > > test case, eventually i am going to be hitting up the fb graph api and > > posting the website's facebook profile, and i'd prefer to keep the > > gallery application useful for both facebook and non-facebook > > integrated websites. > > > I've attempted import signals and import signals.signals in the > > website_project __init__.py. the former resulting in nothing and the > > latter resulting in a "internal server failure" upon restart. > > You should do this the other way round. Keep the signal definition - > the `send_creation` function itself - in signals.py, but don't import > Gallery there. Instead, in gallery/models.py, import the *signal*: > from signals.signals import send_creation - and then do the > registering at the bottom of that file. > -- > 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-us...@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.
signal locations
Now, i've read the thread in regards to putting the import in the __init__.py here is my structure website_project - > signals - - > signals.py (and an __init__.py) - > shared_apps (link to numerous apps shared amongst other projects) - - > gallery application my signals.py looks like this from django.db.models.signals import post_save from django.core.mail import send_mail from gallery.models import Gallery def send_creation(sender, instance, *args, **kwargs): if 'created' in kwargs: if kwargs['created'] and instance.published: send_mail('Subject here',[sender, instance.published, args, kwargs,], 'f...@example.com', ['t...@example.com'], fail_silently=False) post_save.connect(send_creation,sender=Gallery) this works when in the gallery application, however... this is just a test case, eventually i am going to be hitting up the fb graph api and posting the website's facebook profile, and i'd prefer to keep the gallery application useful for both facebook and non-facebook integrated websites. I've attempted import signals and import signals.signals in the website_project __init__.py. the former resulting in nothing and the latter resulting in a "internal server failure" upon restart. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
user defined settings via the admin
having an application specific settings.py is a nice idea, in our world. In the real world websites seem to be managed by non-technical people... and ultimately we're not just building these applications for technologically "gifted" people. Settings should be defined with the admin for certain things... how many blog items or gallery images would you like per page? this shouldn't require a call to "IT support" or granting someone server access to change these settings when they wish (then call IT support when they screw it up) what are our options to grant admin based settings? Obviously a model called settings with perhaps it's own admin template to only allow/ show a single entry into this model/db is possible. But should it really warrant an additional database call every time the page is loaded to grab the settings(lets ignore caching for the moment)? How about an xml file that is editable by the admin? seems like a valid option to have a config.xml associated with a project and to have the admin site access to it, i presume a feature like this would require a hook into the admin site. any input, ideas, experiences? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: multiple views function in a single URL specification
seems like you're over thinking... you want a single url to handle multiple pieces of information? you can assign a single view function to a url. but you can define multiple functions within that view and merely pass them through to the template as part of the response. Or take a look at template tags, as that appears to be more suitable On Oct 17, 1:16 pm, John Yeukhon Wongwrote: > I asked this somewhere else but it seems like the responder hasn't > reply the latest comment I > made.http://stackoverflow.com/questions/3951758/how-do-you-iterate-over-a-... > > Nevertheless, I think I should be welcome to make one here. > > Let's keep thing short. > > Say I have a very simple list to iterate > > [--code--] > def link(request): > c = Context() > c['title'] = ['Home Page', 'Current Time', '10 hours later'] > return render_to_response('time.html', c) > [--code--] > > Now say I also have another view called current_time > > In my html I had, for example > [--code--] > {% for item in title %} > {{item}} > {% if not forloop.last %} | {% endif %} > {% endfor %} > > {% if hour <= 1 %} > do something... > {% endif %} > > [--code--] > > For the template, I tried loop through "in c.title, in c, in title" > and still doesn't work > > As you can guess, I use two view functions in a single html file. > > The problem is that I received 'function' object is not iterable > > So the guy said I probably had a problem with the URL > my URL --> (r'^now/$', current_time, link), > > So he recommended me doing this > (r'^articles/(?P\(?P)/$', > 'project_name.views.link'), #the second tuple element is the view > function > > Something similar to Django URL Dispatcher (from the dispatcher > chapter).. I think... > I think he meant to capture then. But what I want to do is really > just, say, localhost/now/ and load the page > > I can definitely integrate two views functions into one single > function, which works fine. > > The question is, how can I assign multiple views function in a single > URL??? > > Thank you for any input in advance!!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: drupal and django being friends
thanks. so the simple answer is... "tough luck" perhaps i can set up the django app under a different domain name and merely set up domain masking. On Jul 2, 1:15 pm, "Henrik Genssen" <henrik.gens...@miadi.net> wrote: > Hi, > > be sure not to use mod_python and mod_php as stated > here:http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from... > > > > >reply to message: > >date: 02.07.2010 10:39:26 > >from: "garagefan" <monkeygar...@gmail.com> > >to: "Django users" <django-users@googlegroups.com> > >subject: drupal and django being friends > > >So i realize this isn't a specific django question but more of a > >python question and setting up the config file for the server. > > >I know how to set up domains, and the handler and all that for a > >django site. > > >But i've got a drupal site that i'm "attaching" a django gallery > >too... and in fact slowly converting the site over to django as time > >permits, this gallery being the first part. > > >I was under the assumption that placing SetHandler None at the base > >url would result in the entire site being handled > >normally and there wouldn't be an issue... however this only worked > >for the home page. so then i went a long and placed the same code for > >the 7 other urls, since they were returning "not found"... this didn't > >change a thing. > > >so basically... i need my python.conf file to allow apache to handle > >the entire site except for a specific url normally (ie allowing drupal > >to run) > > >-- > >You received this message because you are subscribed to the Google Groups > >"Django users" group. > >To post to this group, send email to django-us...@googlegroups.com. > >To unsubscribe from this group, send email to > >django-users+unsubscr...@googlegroups.com. > >For more options, visit this group > >athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
UnicodeDecodeError
hey all, was wondering if my following error is a result of copying django-tagging and markdown from my windows XP machine onto my server via FTP and then moving them into the appropriate directory. http://kennethdavid.net/blog/2010/may/24/test-1/ just going through the webmonkey tutorial to reacquaint myself with django and python and don't remember getting this error before. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: pyfacebook, No module named facebook.djangofb...
doh, forgot that i never installed python-devel, der... everything works now, nothing to see here... no novice server users here >_> On Aug 27, 11:36 am, garagefan <monkeygar...@gmail.com> wrote: > i've taken the project directly from github and attempted to run > python setup.py install and get the same error: > > running install > error: invalid Python installation: unable to open /usr/lib/python2.5/ > config/Makefile (No such file or directory) > > i assume then, i need to install Makefile? I've attempted to try yum > install Makefile to no success > > On Aug 26, 10:06 pm, Matias <gonzalezmat...@gmail.com> wrote: > > > > > Where did you get the files? > > if you go to the pyfacebook at > > googlehttp://code.google.com/p/pyfacebook/theprojectis now hosted in > > github. > > So if you downloaded from google it may be outdated. > > The installation is much more simpler than what the tutorial says, so i > > recommend to download fromhttp://github.com/sciyoshi/pyfacebook/tree/master > > > HTH, > > > Matias. > > > On Wed, Aug 26, 2009 at 9:58 PM, garagefan <monkeygar...@gmail.com> wrote: > > > > steps followed here: > > > >http://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial > > > > page with error is here: > > > >http://kennethdavid.net/fbapp/fbsample/ > > > > obviously, python.conf is setup correctly to call the correct settings > > > file. facebook is a link (ln -s) to /pyfacebook/facebook, as per > > > instructions. facebook IS in the site-packages directory, same as > > > django > > > > settings as per instructions: > > > > MIDDLEWARE_CLASSES = ( > > > 'django.middleware.common.CommonMiddleware', > > > 'django.contrib.sessions.middleware.SessionMiddleware', > > > 'django.contrib.auth.middleware.AuthenticationMiddleware', > > > 'facebook.djangofb.FacebookMiddleware', > > > ) > > > > svn for pyfacebook ishttp://pyfacebook.googlecode.com/svn/trunk/if > > > anyone wants to check out the files that come in the folders...r > > > you can check them out here > > >http://github.com/sciyoshi/pyfacebook/tree/master > > > > running python setup.py install in pyfacebook ends up being an error > > > looking for config/Makefile saying that it does not exist, infact... i > > > do not have a config dir in python2.5 > > > > any help would be appreciated > > > -- > > :wq --~--~-~--~~~---~--~~ 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: pyfacebook, No module named facebook.djangofb...
i've taken the project directly from github and attempted to run python setup.py install and get the same error: running install error: invalid Python installation: unable to open /usr/lib/python2.5/ config/Makefile (No such file or directory) i assume then, i need to install Makefile? I've attempted to try yum install Makefile to no success On Aug 26, 10:06 pm, Matias <gonzalezmat...@gmail.com> wrote: > Where did you get the files? > if you go to the pyfacebook at > googlehttp://code.google.com/p/pyfacebook/theproject is now hosted in > github. > So if you downloaded from google it may be outdated. > The installation is much more simpler than what the tutorial says, so i > recommend to download fromhttp://github.com/sciyoshi/pyfacebook/tree/master > > HTH, > > Matias. > > > > > > On Wed, Aug 26, 2009 at 9:58 PM, garagefan <monkeygar...@gmail.com> wrote: > > > steps followed here: > > >http://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial > > > page with error is here: > > >http://kennethdavid.net/fbapp/fbsample/ > > > obviously, python.conf is setup correctly to call the correct settings > > file. facebook is a link (ln -s) to /pyfacebook/facebook, as per > > instructions. facebook IS in the site-packages directory, same as > > django > > > settings as per instructions: > > > MIDDLEWARE_CLASSES = ( > > 'django.middleware.common.CommonMiddleware', > > 'django.contrib.sessions.middleware.SessionMiddleware', > > 'django.contrib.auth.middleware.AuthenticationMiddleware', > > 'facebook.djangofb.FacebookMiddleware', > > ) > > > svn for pyfacebook ishttp://pyfacebook.googlecode.com/svn/trunk/if > > anyone wants to check out the files that come in the folders...r > > you can check them out here > >http://github.com/sciyoshi/pyfacebook/tree/master > > > running python setup.py install in pyfacebook ends up being an error > > looking for config/Makefile saying that it does not exist, infact... i > > do not have a config dir in python2.5 > > > any help would be appreciated > > -- > :wq --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
pyfacebook, No module named facebook.djangofb...
steps followed here: http://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial page with error is here: http://kennethdavid.net/fbapp/fbsample/ obviously, python.conf is setup correctly to call the correct settings file. facebook is a link (ln -s) to /pyfacebook/facebook, as per instructions. facebook IS in the site-packages directory, same as django settings as per instructions: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'facebook.djangofb.FacebookMiddleware', ) svn for pyfacebook is http://pyfacebook.googlecode.com/svn/trunk/ if anyone wants to check out the files that come in the folders...r you can check them out here http://github.com/sciyoshi/pyfacebook/tree/master running python setup.py install in pyfacebook ends up being an error looking for config/Makefile saying that it does not exist, infact... i do not have a config dir in python2.5 any help would be appreciated --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
for the thousandth time... No module named django.core.handlers.modpython
http://kennethdavid.net/admin error page: MOD_PYTHON ERROR ProcessId: 9659 Interpreter:'kennethdavid.net' ServerName: 'kennethdavid.net' DocumentRoot: '/home/kdwadmin' URI:'/admin' Location: '/' Directory: None Filename: '/home/kdwadmin/admin' PathInfo: '' Phase: 'PythonHandler' Handler:'django.core.handlers.modpython' Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1202, in _process_target module = import_module(module_name, path=path) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 304, in import_module return __import__(module_name, {}, {}, ['*']) ImportError: No module named django.core.handlers.modpython I know i know, this has been asked a million times... i've looked at the answers and i've checked things... both mod_python and django live in my site packages directory. I've set apache as the group and gave it RWX privileges. i've also insured that the path from site packages to the modpython.py does in fact go through django/core/handlers/modpython at this point, i'm not sure what else to check. my virtual host setup looks like this: NameVirtualHost kennethdavid.net:80 ServerName kennethdavid.net ServerAlias www.kennethdavid.net DocumentRoot /home/kdwadmin SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE kdnet.settings PythonPath "['/home/kdwadmin', '/home/kdwadmin/kdnet'] + sys.path" PythonDebug On obviously it works because its getting to mod_python and getting sick. thanks guys and gals --~--~-~--~~~---~--~~ 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: "SuspiciousOperation" Error While Deleting an Uploaded File
Apache permissions must be set on the directory. I was having the same issue before I set the directory group to be Apache and gave it RWX privileges On Feb 20, 2:21 pm, Tywrote: > When I login to the administration and try to delete a file I get a > "SuspiciousOperation" error. Here's the traceback:http://dpaste.com/123112/ > > Here's my full model:http://dpaste.com/hold/123110/ > > Any help would be appreciated. --~--~-~--~~~---~--~~ 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: Problem outputting date in template as timestamp
server date incorrect? I asked a similar question a while ago... turns out the server i'm using from godaddy was set for Arizona and was an additional 20 some minutes off... On Feb 20, 11:49 am, Sean Brantwrote: > I am trying to render a timestamp in my template with date:"U" but the > timestamps are days off. I wrote up a simple test case that fails. Do > you think this is a bug or a user error? I am running rev: 9846. > > from django.test import TestCase > > class SimpleTest(TestCase): > def test_template_timestamp(self): > from datetime import datetime > from django.template import Context, Template > now = datetime.now() > t = Template('{{ now|date:"U" }}') > c = Context({'now': now}) > self.failUnlessEqual(int(now.strftime('%s')), int(t.render > (c))) > > 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 -~--~~~~--~~--~--~---
Re: Dhango help
i'm just kinda wondering how you're going to be showing a demo of django when you don't know anything about it, nor how to set it up. On Feb 18, 10:19 am, "s.sudharsan siva"wrote: > Hii am new to Django we are planning to show a demo on Django on FOss > conf09.. can any one help with how to start with Django and what to demo > -- > With Regards > S.Sudharsan --~--~-~--~~~---~--~~ 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: Django and php can they mix?
The easiest solution i can consider is having php request a url from the django project that would return a dynamically created xml file that you could then parse via php, set variables from, display, etc. You could theoretically run the site in django, and the admin and all that goodness, but control display via php. I'm not really sure that its worth it though. I'm not a php developer, but there's got to be a php framework that is as simple to use as django as far as database work and an auto admin section is concerned... if not, i suppose it would be worth the hassle. On Feb 16, 8:13 am, TimSSPwrote: > HI, > > I'm looking into using Django to redevelop a website to handle dynamic > content and some social app functions. I am interested in knowing > whether django can work alongside php, we built a modest database to > work on news articles in php and are considering using facebook's api > for an application in the near future. > > I'm wondering whether the facebook would be able to use django on its > frontend or whether it would have to be php coded into that part of > the site. Any help / advice would be a great help, thanks > > Best wishes > > Tim > > email: tim.clar...@gmail.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: Optional m2m relationships in Admin
check out django-tagging. It looks like they're using a custom Manager that is handling the creation of new tags based off of an object that is using "tags" listing new tags. On Feb 4, 3:04 pm, GeneralMeanwrote: > >On 4 Lut, 20:52, koenb wrote: > > Shouldn't this be obj.tags.add(tag) ? (your m2mfield is called tags > > not tag) > > Typo... It actually should say obj.tag.add(tag) - I wasn't pasting > this code, wrote it by hand ;) > Actual code has no syntax errors :) --~--~-~--~~~---~--~~ 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: Optional m2m relationships in Admin
>From my limited understanding of Django... the admin.py stuff should not contain any save function. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin what exactly are you trying to do with the tag? Your M2M field in the initial Game class creates the relationship. You may want to looking into using the django-tagging app, which is what i used for my stupid little blog app (doesn't everyone create that first? lol ) If it helps, the first thing i did when learning django is follow the webmonkey.com django tutorial http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App i found this infinitely more useful than the tutorial on djangoproject.com, as it goes into things a bit more complex and gives a greater idea on how things work together in the framework. Also, don't underestimate the framework... it does a lot of things for you, which is the point. It allows you to build an app quickly without worrying about the annoyances of SQL. On Feb 4, 2:13 pm, GeneralMean <marcin.wtorkow...@gmail.com> wrote: > Thanks for the answer, > > I modified my Game model according to your suggestion, and also, > simplified whole thing. > I can create new game without having to choose any tags - that's > correct. Now, take a look at > the save_model() method in GamesAdmin - I try to associate newly > created Game with some > tag -- with no luck :/ Looks like django admin application prevents > from actual saving _any_ relationship > inside save_model in save() method of Game model as well - tested). > Any ideas how to force create of m2m relationship after the form got > submited, without using raw SQL query? > > Current code: > > #in models.py > class Game(models.Model): > id = models.AutoField(primary_key=True, db_column='grg_id') > tags = models.ManyToManyField(Tag, blank=True, null=True, > related_name='g_tags') > > class Tag(models.Model): > id = models.AutoField(primary_key=True, db_column='grt_id') > tag = models.CharField(max_length=255, unique=True, > db_column='grt_tag') > tag_url = models.CharField(max_length=255, blank=False, > db_column='grt_tag_url') > tag_keyword = models.CharField(max_length=255, blank=False, > db_column='grt_tag_keyword') > > #in admin.py > class GamesAdmin(admin.ModelAdmin): > #NOT using custom form anymore > #form = GamesAdminModelForm > > def save_model(self, request, obj, form, change): > super(GamesAdmin, self).save_model(request, obj, form, change) > if not change: > #get a tag > tag = Tags.objects.get(pk=1) > #associate tag with newly created object > obj.tag.add(tag) > > admin.site.register(Game) > admin.site.register(Tag) > > On 4 Lut, 19:15, garagefan <monkeygar...@gmail.com> wrote: > > > Not totally sure this will help with your error, as i haven't come > > across it yet. > > > But for fields that may be empty I also have a blank = True and null = > > True. This is to tell the DB that it is acceptable to have no value in > > the field. > > > ie, i'm using the following to choose add users to a private forum > > category: > > > allowedUsers = models.ManyToManyField(User, verbose_name=_('Members'), > > blank=True, null=True, > > help_text=_('Select Users that are allowed to view this > > private > > group'), limit_choices_to={'is_staff': False} > > ) --~--~-~--~~~---~--~~ 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: Optional m2m relationships in Admin
Not totally sure this will help with your error, as i haven't come across it yet. But for fields that may be empty I also have a blank = True and null = True. This is to tell the DB that it is acceptable to have no value in the field. ie, i'm using the following to choose add users to a private forum category: allowedUsers = models.ManyToManyField(User, verbose_name=_('Members'), blank=True, null=True, help_text=_('Select Users that are allowed to view this private group'), limit_choices_to={'is_staff': False} ) On Feb 4, 12:07 pm, GeneralMeanwrote: > This is a huge one: > > I want to implement an optional m2m realtionship in django admin > application, so it is possible to create a new Game (model description > below) without choosing any tags associated with it. By default django > form validation returns an error when I try to do such thing. So I > created a new form (GamesAdminModelForm) and specified tag field as > "required=False". It works quite good, to the point when I want to add > some tags "by hand", after user submited the form. For example user > creates new Game, and after successful validation I want to add some > common tags to it. > > The problem is, there is, none of the relations to newly created game > gets saved in DB. No matter what I do, I tried to save it in Game > model method save(), tried to do that in save_model() method of > GamesAdmin (of course after calling obj.save(). Code returns no > exception. I even tried to inject some tags to form in save_model > method, and then re-saving the form - didn't work out well. > > The misterious thing of all, is that when I use function shown below, > everything works allright, to the point when I delete "assert Null" > command. What's with that?? When code throws exception m2m > relationships show up in database, when code DOESN'T throw exception > DB m2m relationship table remains empty. > > def save_model(self, request, obj, form, change): > obj.save() > #get some tag > tag = Tag.objects.get(pk=1) > #add relationship to new object > obj.tag.add(tag) > assert Null > > Hope someone gonna find the right answer. > > Simplified models: > > #in models.py > class Game(models.Model): > id = models.AutoField(primary_key=True, db_column='grg_id') > tags = models.ManyToManyField(Tag, related_name='g_tags') > > class Tag(models.Model): > id = models.AutoField(primary_key=True, db_column='grt_id') > tag = models.CharField(max_length=255, unique=True, > db_column='grt_tag') > tag_url = models.CharField(max_length=255, blank=False, > db_column='grt_tag_url') > tag_keyword = models.CharField(max_length=255, blank=False, > db_column='grt_tag_keyword') > > #in admin.py > class GamesAdmin(admin.ModelAdmin): > form = GamesAdminModelForm > > admin.site.register(Game, GamesAdmin) > admin.site.register(Tag) > > #forms.py > class GamesAdminModelForm(forms.ModelForm): > cover = forms.ImageField(widget=ImageWithThumbnailWidget, > required=False) > tag = forms.ModelMultipleChoiceField(queryset=Tags.objects.all > ().order_by('tag'), required=False, widget=FilteredSelectMultiple > (verbose_name='Tagi', is_stacked=True)) > > class Meta: > model = Game --~--~-~--~~~---~--~~ 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: how to check manytomany field in filter?
well... that worked... to be 100% honest... i didn't expect it to. Guess i'm still underestimating the framework thanks :) On Feb 2, 9:28 pm, Martin Conte Mac Donell <refl...@gmail.com> wrote: > On Tue, Feb 3, 2009 at 12:21 AM, garagefan <monkeygar...@gmail.com> wrote: > > > Trying to test a manytomany field in a model that will be user names. > > Building that is simple enough in the model, and so is selecting the > > users in the admin. > > > the problem is filtering a query to test the current logged in user > > with the manytomany field to ensure they are listed. > > > ie: > > filter(Q(is_private=False) | Q(approvedUsers = str(request.user)) > > > where approvedUsers is the manytomany field > > Actually i don't understand fully what are you trying to do, but based > on your call: > > Did you try filter(Q(is_private=False) | Q(approvedUsers=request.user)? > > M --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to check manytomany field in filter?
Trying to test a manytomany field in a model that will be user names. Building that is simple enough in the model, and so is selecting the users in the admin. the problem is filtering a query to test the current logged in user with the manytomany field to ensure they are listed. ie: filter(Q(is_private=False) | Q(approvedUsers = str(request.user)) where approvedUsers is the manytomany field --~--~-~--~~~---~--~~ 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: views, templates, render and groups
ok... i'm trying to use exclude in the query set to get this to work. I'm not entirely sure how my logic should go though... especially since i would be comparing to lists that would result in <> not being usable... since a user and a group won't contain the same set of groups. is it possible to do use a boolean? i realize list.index(x) returns an error, not a -1 as in java... so how would i get about including a forumgroup.index(User.groups) > -1 of course... that only works if there is one group assigned to the user... i would have to check each group... I'm sure this is a simple logic issue... but i can't seem to figure out what i'd need to do On Jan 19, 1:50 pm, garagefan <monkeygar...@gmail.com> wrote: > pretty vague title i know... > > Can I return a query set via foo.object.filter() where in filter i > check a manytomany field in foo against the group field for a user? > > I guess a way to use a group as a permission? > > IE: An article that would normally appear with a ton of other > articles, in a ManyToMany field tied to groups has been set to Group1. > Now a handful of users are in Group1 and that article is only supposed > to be visible to those people, as well as the other non-group assigned > articles in the list. > > I'd like to take care of this in the views in the render for the > template so that only the objects that can be viewed are passed > through. It seems that permissions are set up by django based on the > models themselves, and i haven't seen anything on creating custom > permissions for groups themselves. So any of the permission check > functions would not work. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
views, templates, render and groups
pretty vague title i know... Can I return a query set via foo.object.filter() where in filter i check a manytomany field in foo against the group field for a user? I guess a way to use a group as a permission? IE: An article that would normally appear with a ton of other articles, in a ManyToMany field tied to groups has been set to Group1. Now a handful of users are in Group1 and that article is only supposed to be visible to those people, as well as the other non-group assigned articles in the list. I'd like to take care of this in the views in the render for the template so that only the objects that can be viewed are passed through. It seems that permissions are set up by django based on the models themselves, and i haven't seen anything on creating custom permissions for groups themselves. So any of the permission check functions would not work. --~--~-~--~~~---~--~~ 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: Standard way to treat temporary data which must be validated manually (by an admin)
why not have two TextFields for the app, one for the approved content, and one for the edited and unapproved content? Write a function that overwrites the content in the approved TextField with the item in the unapproved TextField and delete the unapproved TextField and tie that function to a select box. On Jan 15, 11:17 am, kaskadowrote: > Hi, > not sure the subject said exactly what I want but I tried ;) I'm not a > web app/django expert so I hope you'll understand our problem. > > Let me first describe our system very quickly : > -On one side we have customers publishing content (text + images) > -On the other side, consumers, seeing and using this content > > When a customer publishes content, we want to approve it before the > content goes live to Users > > Until there... fine ;) > > However, when content has already been published, the customer can > still modify it. When a customer make a modification, we want to > approve that before the modification goes live. > > I wonder how are we supposed to treat that : > - Do we store the edited data separately until it is approved ? (we > want the customer to see his non-approved edited data in his view, > while the consumer sees the approved data) > - Do we use 2 databases, like one would use 2 branch codes with > release and development.. > > Help would be much appreciated. > Regards, > Jonathan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
'datetime.datetime' object is unsubscriptable
I'm attempting to install diamanda forum, and so far things are looking promising. however, i am receiving the above error, in the subject, at line 140 of dimandas.pages.feedupdate specifically, the line is: 'date': date[:10] located within a Context. This occurs on save of a new topic. w/o the query limit this file works, but then i get an error: Data truncated for column 'rss' at row 1 the full code for the context itself is: c = Context({ 'user_id': author_system_id, 'username': author[0:14], 'date': date[:10], 'cssclass': cssclass, 'pagination_page': last_pagination_page, 'topic_id': topic_id, 'prefix': prefix, 'topic_title': self.stripper.strip(name), 'text': fbc(text), 'author_anonymous': author_anonymous }) --~--~-~--~~~---~--~~ 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: SuspiciousOperation error saving uploaded files under apache
I ran across this issue. You need make the "group", for the folder you will be saving images into, Apache. And give groups RWX permissions for that folder On Jan 12, 3:43 am, raikwrote: > Hi there, > > I am using a FileField to store user-uploaded files on the server. My > setup works with the development server but raises a > SuspiciousOperation error when I switch to apache2. I spent hours > trying to figure out what's going wrong but I am running out of ideas > now ... > > settings.py: > MEDIA_ROOT = '/var/www/static/' > MEDIA_URL = '/static/' > ... > > /etc/apache2/httpd.conf: > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE brickit.settings > PythonDebug On > PythonOption django.root > PythonPath "['/home/raik/data/py'] + sys.path" > > > SetHandler None > > > SetHandler None > > > The error occurs in /home/raik/data/py/django/core/files/storage.py in > path, line 207 > (example: Attempted access to 'sequencing/traces/2009/01/rg150708-12b- > BBVF2.scf' denied.) > > The django code raising the error looks un-suspicious enough ;) > > def path(self, name): > try: > path = safe_join(self.location, name) > except ValueError: > raise SuspiciousOperation("Attempted access to '%s' > denied." % name) > return os.path.normpath(path) > > The problem seems to be the value of self.location: > In the development server, self.location points to MEDIA_ROOT '/var/ > www/static' as expected. Yet, in the apache process, self.location > points to an empty string "". The debug output tells me that > settings.MEDIA_ROOT is the same with the development and the apache > setup. > > I am pretty lost at this one. Any help is greatly appreciated... > Greetings, > Raik --~--~-~--~~~---~--~~ 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: Change name of imagefield files before they are saved
I may be able to offer some assistance here :) i used the follow bit to create a thumbnail image and changed the name of the file to include _tn. def save(self): super(ImageUpload, self).save() if self.image: tsize = 150,150 path = settings.MEDIA_ROOT + self.image.name img2 = Image.open(path) img2.thumbnail(tsize, Image.ANTIALIAS) img2.save(self.get_thumbnail_path()) def get_thumbnail_path(self): path = settings.MEDIA_ROOT + self.image.name return self.convert_path_to_thumbnail(path) def convert_path_to_thumbnail(self, path): basedir = os.path.dirname(path) + '/' base, ext = os.path.splitext(os.path.basename(path)) th_name = base + "_tn" th_name += ext return urlparse.urljoin(basedir,th_name) On Jan 5, 8:41 pm, geirrwrote: > Hello! > > I'm trying to make a simple photo album application. > > I can't figure out how to change the name of photos that are uploaded > to something different than the name they have locally on my computer. > I want to give the files new names, before they are saved. I am using > the > ImageField model field for the images. > > It looks like I have to override the save function? If this is > correct, how do > I do so? Which variable decides the name of the file? Can anyone point > me in the right direction? > > Thanks, > > -geir --~--~-~--~~~---~--~~ 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: Sort by foreignkey values
http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries i would use .filter and .order_by On Jan 4, 8:30 pm, Patrickwrote: > Ok, I will rephrase that with a concrete example: > I have those to models: > > class Modelo(models.Model): > nome = models.CharField(max_length=10) > manageable = models.BooleanField() > > class Equipamento(models.Model): > modelo = models.ForeignKey(Modelo) > nome = models.CharField(max_length=20) > #manageable = models.BooleanField() > > You see, i want to be able to filter the Equipamento objects based on > the value previously attributed in Modelo, but it seems to be not > possible, since 'manageable' is not an field in Equipamento. But the > workaround would be, create that manageable field, but make it auto- > populated based on the value already defined in the Modelo object, and > hiding it from the user, at the admin page. > > How could I accomplished that? > > Any help, tips, or different approach to accomplish are welcome. > > Thank you in advance. > > On 4 jan, 18:57, Patrick wrote: > > > Hello everybody. > > > Let's say i have the models Model1 and Model2. Model1 has a > > BooleanField called Personalizabe. Model2 has a field named 'model1' > > that is a ForeignKey to Model1. > > > Is there a way, through the admin page, to filter all the Model2 > > objects according to this Personalizable attribute? > > > If not, what is the best approach to achieve this kind of stuff? --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
wish i could edit the previous post... but the styles issue was due to the documentroot being a level below what it should have been... this is working now using the website name as the NameVirtualHost... go figure... the carclubhub.com website is giving me a mod_python error, which is expected as there is no django apps in the directory it is looking for them in. Graham, thanks for all your help. On Jan 4, 6:32 pm, garagefan <monkeygar...@gmail.com> wrote: > will do, going through now... i did find this: > > # UseCanonicalName: Determines how Apache constructs self-referencing > # URLs and the SERVER_NAME and SERVER_PORT variables. > # When set "Off", Apache will use the Hostname and Port supplied > # by the client. When set "On", Apache will use the value of the > # ServerName directive. > # > UseCanonicalName Off > > should i set this to On? > > now... i just took a look at the apache docs and then ran across > > http://www.issociate.de/board/goto/915418/NameVirtualHost_xxx:0_has_n... > > i went with the IP address and added _default_ and now it appears to > be working, despite a warning "Starting httpd: [Sun Jan 04 18:29:52 > 2009] [warn] NameVirtualHost 72.167.92.152:80 has no VirtualHosts" > > django apps work, however now my style sheet does not > > On Jan 4, 6:15 pm, Graham Dumpleton <graham.dumple...@gmail.com> > wrote: > > > Go through all the Apache configuration files and find all mentions of > > NameVirtualHost, Listen and SetHandler directives. Post what they are > > here. If SetHandler is inside of a Location/Directory container, post > > what that container directive is declared as. In turn, if they are > > inside of VirtualHost, post what that container directive is as well. > > Show the order of all relative to each other. > > > In other words, triple check that there are not multiple > > NameVirtualHost directives, or a SetHandler directive at global server > > level which is disabling mod_python inside of VirtualHost. Duplicate > > NameVirtualHost directives is only thing I can think of that could be > > an issue. > > > BTW, do you have an images directory in the carclubhub DocumentRoot. > > Ie., should it be found by the browser? > > > Graham > > > On Jan 5, 9:54 am, garagefan <monkeygar...@gmail.com> wrote: > > > > I have root access. I've just now attempted both moving the > > > NameVirtualHost *:80 around, from the python.conf to the httpd.conf, > > > and changed its location in the httpd.conf. > > > > i've also moved the import for the python.conf as well, from above to > > > below the NameVirtualHost and there have been no changes > > > is there possibly something else that needs to be set up for the > > > VirtualHost to work? > > > > On Jan 4, 5:44 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > > wrote: > > > > > On Jan 5, 8:54 am, garagefan <monkeygar...@gmail.com> wrote: > > > > > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ > > > > > python.conf: > > > > > Invalid command 'xxx', perhaps misspelled or defined by a module not > > > > > included in the server configuration > > > > > > it doesn't appear that anything in the is being read, > > > > > but there are no errors popping up related to it. i've change the *:80 > > > > > to other numbers and have received errors > > > > > > On Jan 4, 4:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > > > > wrote: > > > > > > > Where exactly is the snippet file containing the Apache > > > > > > configuration > > > > > > which you have added? > > > > > > > How is this being included into the main Apache configuration? > > > > > > > Try adding a syntax error into the snippet file, ie., add: > > > > > > > XXX > > > > > > > Then try and restart Apache. If it doesn't complain with an error in > > > > > > Apache error logs, then the configuration file isn't even being read > > > > > > in. > > > > > > > If neither site is showing anything, then all I can guess is that > > > > > > the > > > > > > configuration isn't even being used in the first place. > > > > > The only other thing I can think of is that the order of stuff in main > > > > Apache configuration file, as dictated by where the python.conf > > > > snippet is included, is resulting in some residual configuration > > > > related to configuration of '/' for server taking precedence over the > > > > VirtualHost entries. > > > > > In all, it is just too hard to tell at this point. Is this a managed > > > > server where you can only modify certain Apache files and then use a > > > > web panel to restart it, or do you have full root access? > > > > > Graham --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
will do, going through now... i did find this: # UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables. # When set "Off", Apache will use the Hostname and Port supplied # by the client. When set "On", Apache will use the value of the # ServerName directive. # UseCanonicalName Off should i set this to On? now... i just took a look at the apache docs and then ran across http://www.issociate.de/board/goto/915418/NameVirtualHost_xxx:0_has_no_VirtualHosts.html i went with the IP address and added _default_ and now it appears to be working, despite a warning "Starting httpd: [Sun Jan 04 18:29:52 2009] [warn] NameVirtualHost 72.167.92.152:80 has no VirtualHosts" django apps work, however now my style sheet does not On Jan 4, 6:15 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > Go through all the Apache configuration files and find all mentions of > NameVirtualHost, Listen and SetHandler directives. Post what they are > here. If SetHandler is inside of a Location/Directory container, post > what that container directive is declared as. In turn, if they are > inside of VirtualHost, post what that container directive is as well. > Show the order of all relative to each other. > > In other words, triple check that there are not multiple > NameVirtualHost directives, or a SetHandler directive at global server > level which is disabling mod_python inside of VirtualHost. Duplicate > NameVirtualHost directives is only thing I can think of that could be > an issue. > > BTW, do you have an images directory in the carclubhub DocumentRoot. > Ie., should it be found by the browser? > > Graham > > On Jan 5, 9:54 am, garagefan <monkeygar...@gmail.com> wrote: > > > I have root access. I've just now attempted both moving the > > NameVirtualHost *:80 around, from the python.conf to the httpd.conf, > > and changed its location in the httpd.conf. > > > i've also moved the import for the python.conf as well, from above to > > below the NameVirtualHost and there have been no changes > > is there possibly something else that needs to be set up for the > > VirtualHost to work? > > > On Jan 4, 5:44 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > > On Jan 5, 8:54 am, garagefan <monkeygar...@gmail.com> wrote: > > > > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ > > > > python.conf: > > > > Invalid command 'xxx', perhaps misspelled or defined by a module not > > > > included in the server configuration > > > > > it doesn't appear that anything in the is being read, > > > > but there are no errors popping up related to it. i've change the *:80 > > > > to other numbers and have received errors > > > > > On Jan 4, 4:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > > > wrote: > > > > > > Where exactly is the snippet file containing the Apache configuration > > > > > which you have added? > > > > > > How is this being included into the main Apache configuration? > > > > > > Try adding a syntax error into the snippet file, ie., add: > > > > > > XXX > > > > > > Then try and restart Apache. If it doesn't complain with an error in > > > > > Apache error logs, then the configuration file isn't even being read > > > > > in. > > > > > > If neither site is showing anything, then all I can guess is that the > > > > > configuration isn't even being used in the first place. > > > > The only other thing I can think of is that the order of stuff in main > > > Apache configuration file, as dictated by where the python.conf > > > snippet is included, is resulting in some residual configuration > > > related to configuration of '/' for server taking precedence over the > > > VirtualHost entries. > > > > In all, it is just too hard to tell at this point. Is this a managed > > > server where you can only modify certain Apache files and then use a > > > web panel to restart it, or do you have full root access? > > > > Graham --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
I have root access. I've just now attempted both moving the NameVirtualHost *:80 around, from the python.conf to the httpd.conf, and changed its location in the httpd.conf. i've also moved the import for the python.conf as well, from above to below the NameVirtualHost and there have been no changes is there possibly something else that needs to be set up for the VirtualHost to work? On Jan 4, 5:44 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Jan 5, 8:54 am, garagefan <monkeygar...@gmail.com> wrote: > > > > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ > > python.conf: > > Invalid command 'xxx', perhaps misspelled or defined by a module not > > included in the server configuration > > > it doesn't appear that anything in the is being read, > > but there are no errors popping up related to it. i've change the *:80 > > to other numbers and have received errors > > > On Jan 4, 4:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > > Where exactly is the snippet file containing the Apache configuration > > > which you have added? > > > > How is this being included into the main Apache configuration? > > > > Try adding a syntax error into the snippet file, ie., add: > > > > XXX > > > > Then try and restart Apache. If it doesn't complain with an error in > > > Apache error logs, then the configuration file isn't even being read > > > in. > > > > If neither site is showing anything, then all I can guess is that the > > > configuration isn't even being used in the first place. > > The only other thing I can think of is that the order of stuff in main > Apache configuration file, as dictated by where the python.conf > snippet is included, is resulting in some residual configuration > related to configuration of '/' for server taking precedence over the > VirtualHost entries. > > In all, it is just too hard to tell at this point. Is this a managed > server where you can only modify certain Apache files and then use a > web panel to restart it, or do you have full root access? > > Graham --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ python.conf: Invalid command 'xxx', perhaps misspelled or defined by a module not included in the server configuration it doesn't appear that anything in the is being read, but there are no errors popping up related to it. i've change the *:80 to other numbers and have received errors On Jan 4, 4:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > Where exactly is the snippet file containing the Apache configuration > which you have added? > > How is this being included into the main Apache configuration? > > Try adding a syntax error into the snippet file, ie., add: > > XXX > > Then try and restart Apache. If it doesn't complain with an error in > Apache error logs, then the configuration file isn't even being read > in. > > If neither site is showing anything, then all I can guess is that the > configuration isn't even being used in the first place. > > Graham > > garagefan wrote: > > i do appreciate all your assistance and am growing to understand the > > server side a bit more. you're right about the documentation being... > > light... > > > i've taken what you posted and have not seen a difference at either of > > the websites mentioned the main page results in the base fedora test > > page saying that the server is running. the other pages result in a > > page not found, ie: kennethdavid.net/blog results in this. error logs > > say the same thing, file not found... except for one error, the below > > being located in the error log for kennethdavid.net: > > > [Sun Jan 04 15:55:56 2009] [error] [client 71.230.64.77] Directory > > index forbidden by Options directive: /home/kdwadmin/public_html/ > > > is this possibly what you've mentioned in regards to apache having > > permission to access? permissions for everything are either root as > > owner/group and kdwadmin as owner/group. the only difference is a > > directory in the images directory i had changed to be group apache so > > that it had write privileges for the gallery app to upload images to. > > Also worth noting is that the files in the image directory do indeed > > show up in the browser > > > I'm not seeing any permissions based errors in the httpd error logs > > either, though i could be wrong... here is the error_log from the > > latest restart > > > [Sun Jan 04 15:55:51 2009] [notice] caught SIGTERM, shutting down > > [Sun Jan 04 15:55:51 2009] [notice] suEXEC mechanism enabled > > (wrapper: /usr/sbin/suexec) > > [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf. > > Using default /etc/httpd/logs/mod_jk.log > > [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf. > > Using default /etc/httpd/logs/jk-runtime-status > > [Sun Jan 04 15:55:51 2009] [notice] Digest: generating secret for > > digest authentication ... > > [Sun Jan 04 15:55:51 2009] [notice] Digest: done > > [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf. > > Using default /etc/httpd/logs/mod_jk.log > > [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf. > > Using default /etc/httpd/logs/jk-runtime-status > > [Sun Jan 04 15:55:51 2009] [notice] mod_python: Creating 4 session > > mutexes based on 50 max processes and 0 max threads. > > [Sun Jan 04 15:55:51 2009] [notice] mod_python: using mutex_directory / > > tmp > > [Sun Jan 04 15:55:51 2009] [notice] Apache/2.2.8 (Unix) DAV/2 mod_jk/ > > 1.2.26 PHP/5.2.6 mod_python/3.3.1 Python/2.5 mod_ssl/2.2.8 OpenSSL/ > > 0.9.8b mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal > > operations > > > I do currently have two separate IP addresses for the sites, could > > this be causing the issue? it doesn't seem like it would > > > thanks again for the help, it really is appreciated. > > > -Ken > > > On Jan 4, 12:56 am, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > On Jan 4, 3:11 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > this is rather aggravating as i'm unsure what exactly I need to give > > > > you to help me :/ this isn't your fault at all, as i'm an > > > > unexperienced with working with servers, mod_python, python and > > > > django. > > > > > i am learning all this as I go along. > > > > > i've got two websites on my server, both with different IP addresses > > > > (obviously) > > > > > they reside in > > > > > /home/kdwadmin > > > > and > > > > /home/kdwadmin2 > > > > > the f
Re: python.conf question, multiple sites on same server?
i do appreciate all your assistance and am growing to understand the server side a bit more. you're right about the documentation being... light... i've taken what you posted and have not seen a difference at either of the websites mentioned the main page results in the base fedora test page saying that the server is running. the other pages result in a page not found, ie: kennethdavid.net/blog results in this. error logs say the same thing, file not found... except for one error, the below being located in the error log for kennethdavid.net: [Sun Jan 04 15:55:56 2009] [error] [client 71.230.64.77] Directory index forbidden by Options directive: /home/kdwadmin/public_html/ is this possibly what you've mentioned in regards to apache having permission to access? permissions for everything are either root as owner/group and kdwadmin as owner/group. the only difference is a directory in the images directory i had changed to be group apache so that it had write privileges for the gallery app to upload images to. Also worth noting is that the files in the image directory do indeed show up in the browser I'm not seeing any permissions based errors in the httpd error logs either, though i could be wrong... here is the error_log from the latest restart [Sun Jan 04 15:55:51 2009] [notice] caught SIGTERM, shutting down [Sun Jan 04 15:55:51 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf. Using default /etc/httpd/logs/mod_jk.log [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status [Sun Jan 04 15:55:51 2009] [notice] Digest: generating secret for digest authentication ... [Sun Jan 04 15:55:51 2009] [notice] Digest: done [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf. Using default /etc/httpd/logs/mod_jk.log [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status [Sun Jan 04 15:55:51 2009] [notice] mod_python: Creating 4 session mutexes based on 50 max processes and 0 max threads. [Sun Jan 04 15:55:51 2009] [notice] mod_python: using mutex_directory / tmp [Sun Jan 04 15:55:51 2009] [notice] Apache/2.2.8 (Unix) DAV/2 mod_jk/ 1.2.26 PHP/5.2.6 mod_python/3.3.1 Python/2.5 mod_ssl/2.2.8 OpenSSL/ 0.9.8b mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal operations I do currently have two separate IP addresses for the sites, could this be causing the issue? it doesn't seem like it would thanks again for the help, it really is appreciated. -Ken On Jan 4, 12:56 am, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Jan 4, 3:11 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > this is rather aggravating as i'm unsure what exactly I need to give > > you to help me :/ this isn't your fault at all, as i'm an > > unexperienced with working with servers, mod_python, python and > > django. > > > i am learning all this as I go along. > > > i've got two websites on my server, both with different IP addresses > > (obviously) > > > they reside in > > > /home/kdwadmin > > and > > /home/kdwadmin2 > > > the first directory above has another folder in it w/ my django files. > > full directory is /home/kdwadmin/mysite > > > nevermind that my django files are placed in an inappropriate spot, > > > i will be taking care of that shortly, /home/django/kdwadmin will > > contain the apps for the first site while there will be no directory > > for the second site at this time. > > > my 's were set up as per the djangoprojects.com tutorial > > > the first directory, that includes the django apps, is for website > > kennethdavid.net, the second for carclubhub.com. > > > so what i need to do is set up a virtual host for both sites, one that > > will point kennethdavid.net/* to the django app and another that will > > say carclubhub.com/* SetHandler None > > > there is only one port under "Listen" in the apache config file. > > Should i create an ip specific listen for each website? and have :80 > > for one and :81 for the other and would that allow me to create two > > VirtualHosts? one for each port? > > Sorry if I have come across as a bit short with you. Feeling a bit > under pressure at the moment with a report I have to do for work. I'll > try and explain things in a bit better detail for you. Hopefully it > will help with understanding Django documentation, which in my opinion > is not too clear in some areas in relation to mod_python setup. :-) > > The whole point of virtual hosts as supported by the 'Host' header in > HTTP/1.1 requests, is that it is possible to support multiple named > hosts on a single IP addr
Re: python.conf question, multiple sites on same server?
this is rather aggravating as i'm unsure what exactly I need to give you to help me :/ this isn't your fault at all, as i'm an unexperienced with working with servers, mod_python, python and django. i am learning all this as I go along. i've got two websites on my server, both with different IP addresses (obviously) they reside in /home/kdwadmin and /home/kdwadmin2 the first directory above has another folder in it w/ my django files. full directory is /home/kdwadmin/mysite nevermind that my django files are placed in an inappropriate spot, i will be taking care of that shortly, /home/django/kdwadmin will contain the apps for the first site while there will be no directory for the second site at this time. my 's were set up as per the djangoprojects.com tutorial the first directory, that includes the django apps, is for website kennethdavid.net, the second for carclubhub.com. so what i need to do is set up a virtual host for both sites, one that will point kennethdavid.net/* to the django app and another that will say carclubhub.com/* SetHandler None there is only one port under "Listen" in the apache config file. Should i create an ip specific listen for each website? and have :80 for one and :81 for the other and would that allow me to create two VirtualHosts? one for each port? On Jan 3, 10:21 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Jan 4, 1:39 pm, garagefan <monkeygar...@gmail.com> wrote: > > > there is currently only one virtual host set up, for the site i'm > > working on. I do not need anything to happen with the other url. > > But why are you mentioning 'site2' in one of the other posts and > seeing for it what you only expect for 'site1'. > > > i simply need a virtual host forwww.website.netthatsits at /home/ > > site1/ on my server that has a django directory at /home/site1/mysite > > to work. > > Your initial configuration mentions /home/html in PythonPath. It is > very frustrating when people do not post exactly the Apache > configuration they are using and then try and describe in generic > terms using fake names and paths. It is okay if it is all consistent, > but your descriptions keep changing. > > > the django files themselves at /mysite work just fine, > > Can you clarify when you are talking about a URL or a directory. If a > directory, specify full path. > > That you are mentioning '/mysite' here again is confusing because it > suggests a URL for a Django instance mounted at sub url of site, yet > you already seemed to have said you want to mount it at root of host, > ie., '/'. > > > and > > were working before i attempted to set up the virtual host. and > >www.website.netwas working just fine as well with the way the > > 's are currently set up, before the virtual host stuff was > > added. > > > i figure i'm missing something before the first that is > > causing the issue of the directory for the django apps not to be read. > > I do not want to set them up in the public_html directory as that is > > the main site directory, which if per chance i need to give someone > > access to that... i don't want them in the django directories at all. > > It is unclear here whether you are talking about static files, eg. > images and stylesheets, or Django code. You should never stick Django > directory containing code inside of a Apache DocumentRoot directory > for a host. Your better choices are to copy the static file > directories into DocumentRoot or use a symlink to link them in from a > different location. Depending on Apache configuration you may need to > set FollowSymLinks option. Alternatively, use an Alias directive in > Apache to effectively mount them at required URL from some other > directory location. Either way, mod_python is a PITA in that you need > to have SetHandler None for the URL (Location) context where they are > when whole Django site is mounted at a parent URL to the static files. > > > the server itself is a virtual server from godaddy running red hat 7 > > w/ apache and mod_python. > > > I was looking at a few pages and they mention DocumentRoot... should > > this be to /home/site1 or to the project files? > > As I said above, you should never put Django code in DocumentRoot > because a mistake in Apache configuration can expose your source code > to download. > > > how does PythonInterpreter need to be applied? > > It doesn't if you are only hosting one Django site inside of a > VirtualHost. > > Now, did you get rid of PythonOption to django.root which I said is > not needed if mounting Django at root of site. Be aware though that > that is an option only relevant to Django 1.0. Are you actually using > Django 1.0? If you are using
Re: python.conf question, multiple sites on same server?
there is currently only one virtual host set up, for the site i'm working on. I do not need anything to happen with the other url. my django files are in a folder at the same level as the root folder of the site. i simply need a virtual host for www.website.net that sits at /home/ site1/ on my server that has a django directory at /home/site1/mysite to work. the django files themselves at /mysite work just fine, and were working before i attempted to set up the virtual host. and www.website.net was working just fine as well with the way the 's are currently set up, before the virtual host stuff was added. i figure i'm missing something before the first that is causing the issue of the directory for the django apps not to be read. I do not want to set them up in the public_html directory as that is the main site directory, which if per chance i need to give someone access to that... i don't want them in the django directories at all. the server itself is a virtual server from godaddy running red hat 7 w/ apache and mod_python. I was looking at a few pages and they mention DocumentRoot... should this be to /home/site1 or to the project files? how does PythonInterpreter need to be applied? On Jan 3, 9:22 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Jan 4, 12:53 pm, garagefan <monkeygar...@gmail.com> wrote: > > > no, as then i would need to use, for example...www.website.net/mysite/* > > instead ofwww.website.net/*forthe various apps. > > If you are mounting it at root of web site, you should not be setting > django.root with PythonOption directive for a start. You only need set > django.root when mounted at a sub url. That you had set it gave the > impression you wanted it mounted at a sub url. > > > as i said the locations worked perfectly before attempting to create > > the virtual host. right now i need to have this virtual host point to > > the correct website on my server. > > As I said, you need to provide more complete configuration which shows > both Django sites and how you have set them up. > > If your VirtualHost containers are the same except for ServerName in > each, then show that by providing the configurations for both, or be > clear about that and state it rather than us having to assume what it > all looks like. > > > would i change server name to be an ip address? as each website on my > > server has a unique address, while having the same port? since 80 is > > the open port for apache > > Show configurations for both VirtualHost's and then we may be able to > answer. > > Graham > > > On Jan 3, 8:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > > On Jan 4, 12:17 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > I've read the documentation, and it doesn't seem clear enough, or > > > > provide a fully working example? > > > > > i've copied what i have in my python.conf file, keep in mind that i > > > > have removed site specific names and have made them generic > > > > > NameVirtualHost *:80 > > > > > > > > > ServerNamewww.website.net > > > > > > > > > Presumably you mean /mysite here and not the root of the web server. > > > This needs to match what you have set django.root to. > > > > Graham > > > > > SetHandler python-program > > > > PythonHandler django.core.handlers.modpython > > > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > > > PythonOption django.root /mysite > > > > PythonDebug On > > > > PythonPath "['/home/html'] + sys.path" > > > > > > > > > > > > SetHandler None > > > > > > > > > > > > SetHandler None > > > > > > > > > > > > > i get no python errors, however when i go to the site i receive > > > > nothing. these locations worked previous to attempting to set up a > > > > virtual host. i assume *:80 is the port? in which case, i suppose it > > > > may be possible that the port is incorrect? in which case, i'm unsure > > > > as to where to check this... i assume under the apache conf file? --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
i currently only have two sites, one is not being developed at this time.. but w/o the virtual host that site displays the same apps and info at it's url as the site i am working on, which i do not want to happen. what i have copied for my virtual host is really everything i have. As i said, i have not been able to find much documentation on this so i've been unable to mess around with it myself beyond this point (as this is really only what the djangoproject site shows) each site sits like so... /home/(username)/ username being the base directory... so say /home/site1/ and /home/site2/ both have a /public_html/ directory in them which the server reads as the base level for the site. but with the locations set up in python.conf /mysite/, which is at the same level as public_html in the site1 directory is being used for the apps. location '/' results in being able to target the apps via the first slash in the url after the site name, which is the desired result. however now, i get the apache works page at "www.website.net" and page not founds on anything else that worked previously to attempting to set up the virtual host On Jan 3, 8:50 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > BTW, with mod_python, if trying to host multiple Django sites inside > of same VirtualHost, you must set PythonInterpreter directive > differently for each. > > You really need to provide a more complete example showing all the > sites and how they site with respect to each other and the VirtualHost > in the configuration. > > Graham > > On Jan 4, 12:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> > wrote: > > > On Jan 4, 12:17 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > I've read the documentation, and it doesn't seem clear enough, or > > > provide a fully working example? > > > > i've copied what i have in my python.conf file, keep in mind that i > > > have removed site specific names and have made them generic > > > > NameVirtualHost *:80 > > > > > > > ServerNamewww.website.net > > > > > > > Presumably you mean /mysite here and not the root of the web server. > > This needs to match what you have set django.root to. > > > Graham > > > > SetHandler python-program > > > PythonHandler django.core.handlers.modpython > > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > > PythonOption django.root /mysite > > > PythonDebug On > > > PythonPath "['/home/html'] + sys.path" > > > > > > > > > SetHandler None > > > > > > > > > SetHandler None > > > > > > > > > > i get no python errors, however when i go to the site i receive > > > nothing. these locations worked previous to attempting to set up a > > > virtual host. i assume *:80 is the port? in which case, i suppose it > > > may be possible that the port is incorrect? in which case, i'm unsure > > > as to where to check this... i assume under the apache conf file? --~--~-~--~~~---~--~~ 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: python.conf question, multiple sites on same server?
no, as then i would need to use, for example... www.website.net/mysite/* instead of www.website.net/* for the various apps. as i said the locations worked perfectly before attempting to create the virtual host. right now i need to have this virtual host point to the correct website on my server. would i change server name to be an ip address? as each website on my server has a unique address, while having the same port? since 80 is the open port for apache On Jan 3, 8:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Jan 4, 12:17 pm, garagefan <monkeygar...@gmail.com> wrote: > > > I've read the documentation, and it doesn't seem clear enough, or > > provide a fully working example? > > > i've copied what i have in my python.conf file, keep in mind that i > > have removed site specific names and have made them generic > > > NameVirtualHost *:80 > > > > > ServerNamewww.website.net > > > > > Presumably you mean /mysite here and not the root of the web server. > This needs to match what you have set django.root to. > > Graham > > > SetHandler python-program > > PythonHandler django.core.handlers.modpython > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > PythonOption django.root /mysite > > PythonDebug On > > PythonPath "['/home/html'] + sys.path" > > > > > > SetHandler None > > > > > > SetHandler None > > > > > > > i get no python errors, however when i go to the site i receive > > nothing. these locations worked previous to attempting to set up a > > virtual host. i assume *:80 is the port? in which case, i suppose it > > may be possible that the port is incorrect? in which case, i'm unsure > > as to where to check this... i assume under the apache conf file? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
python.conf question, multiple sites on same server?
I've read the documentation, and it doesn't seem clear enough, or provide a fully working example? i've copied what i have in my python.conf file, keep in mind that i have removed site specific names and have made them generic NameVirtualHost *:80 ServerName www.website.net SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /mysite PythonDebug On PythonPath "['/home/html'] + sys.path" SetHandler None SetHandler None i get no python errors, however when i go to the site i receive nothing. these locations worked previous to attempting to set up a virtual host. i assume *:80 is the port? in which case, i suppose it may be possible that the port is incorrect? in which case, i'm unsure as to where to check this... i assume under the apache conf file? --~--~-~--~~~---~--~~ 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: one server, multiple sites...
figured out the issue was with the * not including a port :) now, pages aren't actually working... NameVirtualHost *:80 ServerName www.site.net SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /mysite PythonDebug On PythonPath "['/home/site'] + sys.path" SetHandler None SetHandler None On Dec 30, 8:14 pm, garagefan <monkeygar...@gmail.com> wrote: > and i don't want one to access another's django installation... > > and the following doesn't seem to work > NameVirtualHost * > > > ServerNamewww.website.net > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonOption django.root /mysite > PythonDebug On > PythonPath "['/home/site'] + sys.path" > > > SetHandler None > > > SetHandler None > > > > and this is the error i get: VirtualHost _default_:443 -- mixing * > ports and non-* ports with a NameVirtualHost address is not supported, > proceeding with undefined results --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
one server, multiple sites...
and i don't want one to access another's django installation... and the following doesn't seem to work NameVirtualHost * ServerName www.website.net SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /mysite PythonDebug On PythonPath "['/home/site'] + sys.path" SetHandler None SetHandler None and this is the error i get: VirtualHost _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results --~--~-~--~~~---~--~~ 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: working with a returned object inside another class
Thanks, that worked perfectly. right now i can lose the data as i'm still learning this all. I will have to look into editing the DB via the shell for future fixes On Dec 29, 11:20 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On Dec 29, 11:04 pm, garagefan <monkeygar...@gmail.com> wrote: > > > awesome... it was all in that [:1]! > > > now, next issue... > > > "OperationalError at /admin/galleries/gallery/ > > (1054, "Unknown column 'galleries_gallery.status' in 'field list'")" > > > i just added the status field as i wasn't worried about any of that > > previously... now, it appears to be causing issues. I've ran syncdb, > > but it doesn't seem to be adding this new column. I gather it is very > > very important to consider your required fields before syncing > > originally... how do i go about fixing this issue? > > > thanks again > > Syncdb doesn't modify existing tables. If you don't have any data you > need to keep, you can run > ./manage.py reset galleries > Note that this will completely delete and recreate your tables. If you > want to preserve existing data, you'll need to go into your database > shell (via ./manage.py dbshell) and run the SQL to modify your table > manually - something like > ALTER TABLE `galleries_gallery` ADD COLUMN `status` VARCHAR(1) NOT > NULL; > (guessing at the column definition, change as required). > > -- > 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 -~--~~~~--~~--~--~---
Re: working with a returned object inside another class
awesome... it was all in that [:1]! now, next issue... "OperationalError at /admin/galleries/gallery/ (1054, "Unknown column 'galleries_gallery.status' in 'field list'")" i just added the status field as i wasn't worried about any of that previously... now, it appears to be causing issues. I've ran syncdb, but it doesn't seem to be adding this new column. I gather it is very very important to consider your required fields before syncing originally... how do i go about fixing this issue? thanks again On Dec 29, 9:46 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On Dec 29, 9:02 pm, garagefan <monkeygar...@gmail.com> wrote: > > > > > below is the code... the first def doesn't return anything... (def > > get_gal_teaser(self)) > > i'm using a custom tag to return the Gallery class to the base > > template file, which works... so calling the method get_gal_teaser > > works as well... and returns an object? when the second e = > > e.image.get_thumbnail_url() is not there... ie this is returned: > > [] > > > i want to return, obviously from above, the get_thumbnail url method > > so i can work with html/css to display it nicely in a secondary nav > > > class Gallery(models.Model): > > name = models.CharField(max_length=200) > > descrip = models.TextField() > > gallery_id = models.AutoField(primary_key=True) > > > def get_gal_teaser(self): > > e = ImageUpload.objects.filter(gallery = self.gallery_id)[:1] > > e = e.image.get_thumbnail_url() > > return e > > > def __unicode__(self): > > return u'%s ' %(self.name) > > > class ImageUpload(models.Model): > > title = models.CharField(max_length=200) > > image = models.ImageField(upload_to = 'gallery') > > gallery = models.ForeignKey('Gallery') > > > def save(self): > > super(ImageUpload, self).save() > > if self.image: > > tsize = 150,150 > > path = settings.MEDIA_ROOT + self.image.name > > img2 = Image.open(path) > > img2.thumbnail(tsize, Image.ANTIALIAS) > > img2.save(self.get_thumbnail_path()) > > > def get_thumbnail_path(self): > > path = settings.MEDIA_ROOT + self.image.name > > return self.convert_path_to_thumbnail(path) > > > def convert_path_to_thumbnail(self, path): > > basedir = os.path.dirname(path) + '/' > > base, ext = os.path.splitext(os.path.basename(path)) > > th_name = base + "_tn" > > th_name += ext > > return urlparse.urljoin(basedir,th_name) > > > def get_thumbnail_url(self): > > path = settings.MEDIA_ROOT + self.image.name > > You haven't clearly explained what the problem is, but there are two > issues here. > > Firstly, get_gal_teaser method as written could not work. This slice - > [:1] - returns a list containing one item, so at that point e is still > a list. So e.image would fail. > > To make this work as written, just drop the colon. > e = ImageUpload.objects.filter(gallery = self.gallery_id)[1] > Now e is a single ImageUpload object, and e.image will work. > > Secondly, the get_thumbnail_url method on ImageUpload does not return > anything. You set the variable 'path', but don't return it. Add this: > return path > at the end. > -- > 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 -~--~~~~--~~--~--~---
working with a returned object inside another class
below is the code... the first def doesn't return anything... (def get_gal_teaser(self)) i'm using a custom tag to return the Gallery class to the base template file, which works... so calling the method get_gal_teaser works as well... and returns an object? when the second e = e.image.get_thumbnail_url() is not there... ie this is returned: [] i want to return, obviously from above, the get_thumbnail url method so i can work with html/css to display it nicely in a secondary nav class Gallery(models.Model): name = models.CharField(max_length=200) descrip = models.TextField() gallery_id = models.AutoField(primary_key=True) def get_gal_teaser(self): e = ImageUpload.objects.filter(gallery = self.gallery_id)[:1] e = e.image.get_thumbnail_url() return e def __unicode__(self): return u'%s ' %(self.name) class ImageUpload(models.Model): title = models.CharField(max_length=200) image = models.ImageField(upload_to = 'gallery') gallery = models.ForeignKey('Gallery') def save(self): super(ImageUpload, self).save() if self.image: tsize = 150,150 path = settings.MEDIA_ROOT + self.image.name img2 = Image.open(path) img2.thumbnail(tsize, Image.ANTIALIAS) img2.save(self.get_thumbnail_path()) def get_thumbnail_path(self): path = settings.MEDIA_ROOT + self.image.name return self.convert_path_to_thumbnail(path) def convert_path_to_thumbnail(self, path): basedir = os.path.dirname(path) + '/' base, ext = os.path.splitext(os.path.basename(path)) th_name = base + "_tn" th_name += ext return urlparse.urljoin(basedir,th_name) def get_thumbnail_url(self): path = settings.MEDIA_ROOT + self.image.name --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
custome tags, single model, multiple classes
I've got a gallery model, with a Gallery class, and an ImageUpload class. in my custom tag i'm pulling in the Gallery to display a list of galleries in a side bar. this works fine. But, i want to randomly display an image associated with that gallery, which would be accessed through ImageUpload (i should change the class name to Image). do i create another class in the single custom tag in the templatestag directory? or can i create another tag in that directory? or... do i create a method inside the Gallery class so that it is accessible that way? 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 -~--~~~~--~~--~--~---
Re: displaying correct image url
the ability to edit posts would be nice :) i figured out the issue and am now displaying relative urls to the images. now, to edit the delete function to remove the thumbnails as well... On Dec 27, 1:21 pm, garagefan <monkeygar...@gmail.com> wrote: > currently, self.image.name displays the absolute server path... > > i want to change this so that when i call it, it either display the > relative path, or an absolute path for the website itself. > > so instead of displaying /home/site/mysite/images/gallery/ > imagename.jpg > > it will displayhttp://www.sitename/images/gallery/imagename.jpg > > in settings i have: > > MEDIA_ROOT = '/home/site/mysite/images' > MEDIA_URL = 'http://www.sitename.com/images/' > > in the models.py: > > image = models.ImageField(upload_to='/home/site/mysite/images/ > gallery') > > "mysite" being the base level directory for the site itself --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
displaying correct image url
currently, self.image.name displays the absolute server path... i want to change this so that when i call it, it either display the relative path, or an absolute path for the website itself. so instead of displaying /home/site/mysite/images/gallery/ imagename.jpg it will display http://www.sitename/images/gallery/imagename.jpg in settings i have: MEDIA_ROOT = '/home/site/mysite/images' MEDIA_URL = 'http://www.sitename.com/images/' in the models.py: image = models.ImageField(upload_to='/home/site/mysite/images/ gallery') "mysite" being the base level directory for the site itself --~--~-~--~~~---~--~~ 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: setting the proper file permisions chmod
fantastic that worked amazingly well. thank you On Dec 15, 12:23 pm, Brian Neal <bgn...@gmail.com> wrote: > On Dec 15, 10:53 am, garagefan <monkeygar...@gmail.com> wrote:> how would i > make the group include apache? > > Not sure what you are asking. I look in /etc/group to see what groups > apache belongs to. On my system, apache belongs to a group called > apache. So I did something like: > > # chgrp apache uploads > # chmod 775 uploads --~--~-~--~~~---~--~~ 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: setting the proper file permisions chmod
how would i make the group include apache? On Dec 15, 11:32 am, Brian Neal <bgn...@gmail.com> wrote: > On Dec 15, 9:51 am, garagefan <monkeygar...@gmail.com> wrote: > > > Just wondering if anyone else has experience with setting the write > > permissions for apache using mod_python w/ django. > > Instead of 0777 I use 0775. I chgrp on the uploads directory, making > the group be a group that includes the apache user. --~--~-~--~~~---~--~~ 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: setting the proper file permisions chmod
Just wondering if anyone else has experience with setting the write permissions for apache using mod_python w/ django. On Dec 11, 6:01 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Dec 12, 9:07 am,garagefan<monkeygar...@gmail.com> wrote: > > > which would actually result in keeping my server more secure... i > > would assume leaving other with rwx would be paramount to keeping my > > front door wide open? > > The risk is more from users who have shell accounts on the same > system, or have web applications running as different user. Those > users would be able to modify stuff in that directory even though they > aren't owner. > > It doesn't change the risk in respect of other web application code > running under mod_python or PHP which also runs as Apache user. Such > code because runs as Apache user would be able to write to the > directory even if owned by Apache user and not o+rwx. > > > I'll look into mod_wsgi... but i can't imagine that every person > > running mod_python and working with file uploads hasn't had to combat > > this little issue. > > Based on posts one sees, a lot of people just make it o+rwx and leave > it at that. > > > is there really a safety concern? > > If you are fully in control of the system and no other users on it, it > is not good, but not disastrous. > > > or is there another way around this? > > Make the user owned by Apache user instead and don't have o+rwx. > > I am biased, but arguable that mod_wsgi is a better overall choice > these days than mod_python anyway and with mod_python fading away to a > degree, better long term choice. > > Graham > > > On Dec 11, 4:59 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > > On Dec 12, 8:52 am,garagefan<monkeygar...@gmail.com> wrote: > > > > > this is my first time working this closely to the server for a live > > > > environment :) > > > > > "apache" appears as owner of the file once uploaded. is there a way to > > > > set the default on this to be another user? > > > > Only by using Apache/mod_wsgi (not mod_python) and specifically using > > > mod_wsgi daemon mode, with a distinct user defined for the daemon > > > process and thus your Django application to run as. > > > > Graham > > > > > On Dec 11, 4:45 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > > > wrote: > > > > > > On Dec 12, 8:32 am,garagefan<monkeygar...@gmail.com> wrote: > > > > > > > I figured out my issue with the "access denied, suspicious > > > > > > operation" > > > > > > bull... > > > > > > > apparently the only way the admin side of my site can upload an > > > > > > image > > > > > > to a directory is by having "other" set to have full rwx set... ie > > > > > > chmod **7 I'm not so sure this is a good thing to keep set as that > > > > > > would give everyone, logged in or other, access to overwriting data, > > > > > > adding stuff, etc... right? > > > > > > Who owns the files once uploaded? > > > > > > Whoever that is should be the owner of the directory. Sounds like you > > > > > are running under Apache and don't understand that your code runs as > > > > > the Apache user. > > > > > > Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
generating an image?
Is it possible to generate an image, to save it on my server, of a web page by passing through the url only? say perhaps I want to link to a few sites from mine, and i'd like to include a thumbnail of the site... and instead of taking a screen capture, and uploading it, i pass through the url of the page, and the image of the homepage is generated from that. 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 -~--~~~~--~~--~--~---
Re: setting the proper file permisions chmod
which would actually result in keeping my server more secure... i would assume leaving other with rwx would be paramount to keeping my front door wide open? I'll look into mod_wsgi... but i can't imagine that every person running mod_python and working with file uploads hasn't had to combat this little issue. is there really a safety concern? or is there another way around this? On Dec 11, 4:59 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Dec 12, 8:52 am, garagefan <monkeygar...@gmail.com> wrote: > > > this is my first time working this closely to the server for a live > > environment :) > > > "apache" appears as owner of the file once uploaded. is there a way to > > set the default on this to be another user? > > Only by using Apache/mod_wsgi (not mod_python) and specifically using > mod_wsgi daemon mode, with a distinct user defined for the daemon > process and thus your Django application to run as. > > Graham > > > On Dec 11, 4:45 pm, Graham Dumpleton <graham.dumple...@gmail.com> > > wrote: > > > > On Dec 12, 8:32 am, garagefan <monkeygar...@gmail.com> wrote: > > > > > I figured out my issue with the "access denied, suspicious operation" > > > > bull... > > > > > apparently the only way the admin side of my site can upload an image > > > > to a directory is by having "other" set to have full rwx set... ie > > > > chmod **7 I'm not so sure this is a good thing to keep set as that > > > > would give everyone, logged in or other, access to overwriting data, > > > > adding stuff, etc... right? > > > > Who owns the files once uploaded? > > > > Whoever that is should be the owner of the directory. Sounds like you > > > are running under Apache and don't understand that your code runs as > > > the Apache user. > > > > Graham --~--~-~--~~~---~--~~ 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: setting the proper file permisions chmod
this is my first time working this closely to the server for a live environment :) "apache" appears as owner of the file once uploaded. is there a way to set the default on this to be another user? On Dec 11, 4:45 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Dec 12, 8:32 am, garagefan <monkeygar...@gmail.com> wrote: > > > I figured out my issue with the "access denied, suspicious operation" > > bull... > > > apparently the only way the admin side of my site can upload an image > > to a directory is by having "other" set to have full rwx set... ie > > chmod **7 I'm not so sure this is a good thing to keep set as that > > would give everyone, logged in or other, access to overwriting data, > > adding stuff, etc... right? > > Who owns the files once uploaded? > > Whoever that is should be the owner of the directory. Sounds like you > are running under Apache and don't understand that your code runs as > the Apache user. > > Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
setting the proper file permisions chmod
I figured out my issue with the "access denied, suspicious operation" bull... apparently the only way the admin side of my site can upload an image to a directory is by having "other" set to have full rwx set... ie chmod **7 I'm not so sure this is a good thing to keep set as that would give everyone, logged in or other, access to overwriting data, adding stuff, etc... right? --~--~-~--~~~---~--~~ 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: image uploading via admin, and an error...
alright, managed to work my way around and get the jpeg uploading to work... expect i'm still getting that suspicious operation error On Dec 10, 4:49 pm, Brian Neal <[EMAIL PROTECTED]> wrote: > On Dec 10, 2:20 pm, garagefan <[EMAIL PROTECTED]> wrote: > > > getting this error: > > > "Upload a valid image. The file you uploaded was either not an image > > or a corrupted image." > > > tried with a gif and with a jpg. I've got PIL installed..." > > You may not have the correct libraries installed for PIL to work with > gif's and jpegs. I think I ran into this. I believe there is something > in the PIL docs that notes this and tells you what other packages you > need to install to support those formats. > > Best, > BN --~--~-~--~~~---~--~~ 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: image uploading via admin, and an error...
I attempted this with a png and was greeted with a success... but then python/server denying access to the directory due to "suspicious operation"... so i've got two things to fix... I suppose i need to set up some kind of write access to the server? On Dec 10, 3:20 pm, garagefan <[EMAIL PROTECTED]> wrote: > getting this error: > > "Upload a valid image. The file you uploaded was either not an image > or a corrupted image." > > tried with a gif and with a jpg. I've got PIL installed... > > it probably has to do with my models.vi. > > from django.db import models > from django.core.files.storage import FileSystemStorage > > from tagging.fields import TagField > from tagging.models import Tag > > class Portfolio(models.Model): > sitename = models.CharField(max_length=200) > url = models.CharField(max_length=200) > thumb = models.ImageField(upload_to='/images/portfolio') > description = models.TextField() > tags = TagField() > > def __unicode__(self): > return u'%s' %(self.sitename) > > do i need to do anything with the Storage API to get this to work? Or > is there a certain item i need to place in "INSTALLED_APPS"? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
image uploading via admin, and an error...
getting this error: "Upload a valid image. The file you uploaded was either not an image or a corrupted image." tried with a gif and with a jpg. I've got PIL installed... it probably has to do with my models.vi. from django.db import models from django.core.files.storage import FileSystemStorage from tagging.fields import TagField from tagging.models import Tag class Portfolio(models.Model): sitename = models.CharField(max_length=200) url = models.CharField(max_length=200) thumb = models.ImageField(upload_to='/images/portfolio') description = models.TextField() tags = TagField() def __unicode__(self): return u'%s' %(self.sitename) do i need to do anything with the Storage API to get this to work? Or is there a certain item i need to place in "INSTALLED_APPS"? --~--~-~--~~~---~--~~ 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: issue with django tagging
http://code.google.com/p/django-tagging/issues/detail?id=110 On Dec 10, 9:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > thanks > after I imported tagging,the errors is following: > Traceback (most recent call last): > File "", line 1, in > import tagging > File "C:\Python25\Lib\site-packages\tagging\__init__.py", line 3, in > > from tagging.managers import ModelTaggedItemManager, TagDescriptor > File "C:\Python25\Lib\site-packages\tagging\managers.py", line 5, in > > from django.contrib.contenttypes.models import ContentType > File "C:\Python25\Lib\site-packages\django\contrib\contenttypes > \models.py", line 1, in > from django.db import models > File "C:\Python25\Lib\site-packages\django\db\__init__.py", line 9, > in > if not settings.DATABASE_ENGINE: > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 28, in __getattr__ > self._import_settings() > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 57, in _import_settings > raise ImportError("Settings cannot be imported, because > environment variable %s is undefined." % ENVIRONMENT_VARIABLE) > ImportError: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined. > > On Dec 10, 12:00 am, Mario <[EMAIL PROTECTED]> wrote: > > > Try typing the following: > > > python manage.py shell > > > from the python shell, type: > > > import tagging > > tagging.VERSION > > > Regards > > > On Dec 9, 8:24 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > hi > > > I got it from trunk,and the version is 0.3. After I installed > > > tagging , I cannot import it. The error information is following: > > > > Thank you very much > > > > --- > > > IDLE 1.2.2 > > > > >>> import tagging > > > > Traceback (most recent call last): > > > File " ", line 1, in > > > import tagging > > > File "C:\Python25\Lib\site-packages\tagging\__init__.py", line 3, in > > > > > > from tagging.managers import ModelTaggedItemManager, TagDescriptor > > > File "C:\Python25\Lib\site-packages\tagging\managers.py", line 5, in > > > > > > from django.contrib.contenttypes.models import ContentType > > > File "C:\Python25\Lib\site-packages\django\contrib\contenttypes > > > \models.py", line 1, in > > > from django.db import models > > > File "C:\Python25\Lib\site-packages\django\db\__init__.py", line 9, > > > in > > > if not settings.DATABASE_ENGINE: > > > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > > > 28, in __getattr__ > > > self._import_settings() > > > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > > > 57, in _import_settings > > > raise ImportError("Settings cannot be imported, because > > > environment variable %s is undefined." % ENVIRONMENT_VARIABLE) > > > ImportError: Settings cannot be imported, because environment variable > > > DJANGO_SETTINGS_MODULE is undefined. --~--~-~--~~~---~--~~ 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: time it takes django to read database?
haha yeah, i just submitted a ticket to godaddy. They're usually really good with getting back. On Dec 9, 6:31 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote: > On Tue, Dec 9, 2008 at 3:22 PM, garagefan <[EMAIL PROTECTED]> wrote: > > > ok, server time is 2 hours and 11 minutes behind... this could explain > > the issue then. The admin section, when creating a new entry takes the > > time current actual time. So it makes 100% sense that django/python is > > reading the incorrect time. I've attempted to update the server time > > using the usual date "time" crap and was told the procedure was not > > allowed, i assume this is due the server being a virtual server. > > > what would the best way to fix this? > > Call tech support... > > Colin --~--~-~--~~~---~--~~ 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: time it takes django to read database?
ok, server time is 2 hours and 11 minutes behind... this could explain the issue then. The admin section, when creating a new entry takes the time current actual time. So it makes 100% sense that django/python is reading the incorrect time. I've attempted to update the server time using the usual date "time" crap and was told the procedure was not allowed, i assume this is due the server being a virtual server. what would the best way to fix this? the detail.html does not use latest however On Dec 9, 4:40 pm, garagefan <[EMAIL PROTECTED]> wrote: > awesome, i will take a look at the server date. It is possible that it > is off. > > On Dec 9, 3:57 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote: > > > On Tue, Dec 9, 2008 at 12:16 PM, garagefan <[EMAIL PROTECTED]> wrote: > > > > Server is Red Hat 7, set up by godaddy, its a virtual server. Python > > > 2.5 w/ mod_python and python-devel installed. running latest django. > > > > I am using webmonkey.com's tutorial for this: > > >http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First... > > > > so you can find the blog app as well as the templates in there. The > > > part that is working instantly is the "secondary" section located in > > > the base.html template that the other two blog templates extend > > > > thanks for lookin > > > Ah, didn't realize that it was showing one part of the page and not > > another. Looks like the template tag in the "secondary" section > > queries all of the blog post objects, while the main section uses the > > "latest" variable from django.views.generic.date_based.archive_index. > > According to the docs, "Objects with a date in the future are not > > included (in latest) unless you set allow_future to True." > > >http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-... > > > Any chance the dates on your posts are set to the future? Is the date > > set correctly on your server? > > > Colin --~--~-~--~~~---~--~~ 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: time it takes django to read database?
awesome, i will take a look at the server date. It is possible that it is off. On Dec 9, 3:57 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote: > On Tue, Dec 9, 2008 at 12:16 PM, garagefan <[EMAIL PROTECTED]> wrote: > > > Server is Red Hat 7, set up by godaddy, its a virtual server. Python > > 2.5 w/ mod_python and python-devel installed. running latest django. > > > I am using webmonkey.com's tutorial for this: > >http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First... > > > so you can find the blog app as well as the templates in there. The > > part that is working instantly is the "secondary" section located in > > the base.html template that the other two blog templates extend > > > thanks for lookin > > Ah, didn't realize that it was showing one part of the page and not > another. Looks like the template tag in the "secondary" section > queries all of the blog post objects, while the main section uses the > "latest" variable from django.views.generic.date_based.archive_index. > According to the docs, "Objects with a date in the future are not > included (in latest) unless you set allow_future to True." > > http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-... > > Any chance the dates on your posts are set to the future? Is the date > set correctly on your server? > > Colin --~--~-~--~~~---~--~~ 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: time it takes django to read database?
Server is Red Hat 7, set up by godaddy, its a virtual server. Python 2.5 w/ mod_python and python-devel installed. running latest django. I am using webmonkey.com's tutorial for this: http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App so you can find the blog app as well as the templates in there. The part that is working instantly is the "secondary" section located in the base.html template that the other two blog templates extend thanks for lookin On Dec 9, 2:58 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote: > On Sun, Dec 7, 2008 at 7:32 PM, garagefan <[EMAIL PROTECTED]> wrote: > > > following another tutorial to build a blog (webmonkey.com's) at it was > > rather frustrating to see nothing show up after creating a new blog... > > > the admin section seems to see these right away, as they are there as > > soon as you hit save. But it seems to take the one section 10-20(or > > more?) minutes to read that they are there, while another section on > > the same page (that lists the items by title) no time at all. though > > when I update something that is listed already in the main section > > (the area that takes a while to get new info) it gets updated > > immediately... such as the title or entry > > >http://kennethdavid.net/mysite/blog/ > > > most likely if you look within 5-10 minutes you'll see how there are > > three entry titles, and two blogs... i'll go ahead and add another > > entry, so at the very least there will be 4 titles and three available > > entries... > > > what would possibly cause this? > > Also, what kind of server setup are you using? Can you reproduce this > issue on a local development server? > > Colin --~--~-~--~~~---~--~~ 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: issue with django tagging
I had the same issue... you need to do two things... copy this into the setup.py from django.conf import settings settings.configure() and make sure you have python-devel installed On Dec 9, 8:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hi > I got it from trunk,and the version is 0.3. After I installed > tagging , I cannot import it. The error information is following: > > Thank you very much > > --- > IDLE 1.2.2 > > >>> import tagging > > Traceback (most recent call last): > File "", line 1, in > import tagging > File "C:\Python25\Lib\site-packages\tagging\__init__.py", line 3, in > > from tagging.managers import ModelTaggedItemManager, TagDescriptor > File "C:\Python25\Lib\site-packages\tagging\managers.py", line 5, in > > from django.contrib.contenttypes.models import ContentType > File "C:\Python25\Lib\site-packages\django\contrib\contenttypes > \models.py", line 1, in > from django.db import models > File "C:\Python25\Lib\site-packages\django\db\__init__.py", line 9, > in > if not settings.DATABASE_ENGINE: > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 28, in __getattr__ > self._import_settings() > File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line > 57, in _import_settings > raise ImportError("Settings cannot be imported, because > environment variable %s is undefined." % ENVIRONMENT_VARIABLE) > ImportError: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined. --~--~-~--~~~---~--~~ 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: time it takes django to read database?
sure thing: from django.conf.urls.defaults import * from mysite.blog.models import Entry from tagging.views import tagged_object_list info_dict = { 'queryset': Entry.objects.filter(status=1), 'date_field': 'pub_date', } urlpatterns = patterns('django.views.generic.date_based', (r'(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='blog/detail.html')), (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', 'object_detail', dict(info_dict, template_name='blog/list.html')), (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/ $','archive_day',dict(info_dict,template_name='blog/list.html')), (r'^(?P\d{4})/(?P[a-z]{3})/$','archive_month', dict(info_dict, template_name='blog/list.html')), (r'^(?P\d{4})/$','archive_year', dict(info_dict, template_name='blog/list.html')), (r'^$','archive_index', dict(info_dict, template_name='blog/ list.html')), ) On Dec 8, 7:29 pm, "Jay Parlar" <[EMAIL PROTECTED]> wrote: > Could you post your urls.py file for your blog app? It's very easy to > make a mistake in there that results in confusing time-related errors. > > Jay 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: time it takes django to read database?
I've not set anything up... On Dec 8, 1:48 am, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > Do you use caching? > > On Mon, Dec 8, 2008 at 07:34, garagefan <[EMAIL PROTECTED]> wrote: > > > ok... i've been able to figure out how long it takes based on the time > > stamp... an hour and a half for a new object to have come in. It > > appears that the item is not readable by the two templates, one of > > which using {%for object in latest $} and then another template that > > doesn't use it at all. > > > the code that reads the objects instantly is: > > > {% for obj in recent_posts %} > > > > > > {{ obj.title}} > > > > {% endfor %} > > > which is getting the info from: > > > from django.template import Library, Node > > from django.db.models import get_model > > > register = Library() > > > class LatestContentNode(Node): > > def __init__(self, model, num, varname): > > self.num, self.varname = num, varname > > self.model = get_model(*model.split('.')) > > > def render(self, context): > > context[self.varname] = self.model._default_manager.filter > > (status=1)[:self.num] > > return '' > > > def get_latest(parser, token): > > bits = token.contents.split() > > if len(bits) != 5: > > raise TemplateSyntaxError, "get_latest tag takes exactly four > > arguments" > > if bits[3] != 'as': > > raise TemplateSyntaxError, "third argument to get_latest tag > > must be 'as'" > > return LatestContentNode(bits[1], bits[2], bits[4]) > > > get_latest = register.tag(get_latest) > > > an hour and a half is a bit much... i could deal with 5-10 minutes, > > but at the same time, if the "Recent entries" list reads > > immediately... so should the rest of the site --~--~-~--~~~---~--~~ 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: time it takes django to read database?
ok... i've been able to figure out how long it takes based on the time stamp... an hour and a half for a new object to have come in. It appears that the item is not readable by the two templates, one of which using {%for object in latest $} and then another template that doesn't use it at all. the code that reads the objects instantly is: {% for obj in recent_posts %} {{ obj.title}} {% endfor %} which is getting the info from: from django.template import Library, Node from django.db.models import get_model register = Library() class LatestContentNode(Node): def __init__(self, model, num, varname): self.num, self.varname = num, varname self.model = get_model(*model.split('.')) def render(self, context): context[self.varname] = self.model._default_manager.filter (status=1)[:self.num] return '' def get_latest(parser, token): bits = token.contents.split() if len(bits) != 5: raise TemplateSyntaxError, "get_latest tag takes exactly four arguments" if bits[3] != 'as': raise TemplateSyntaxError, "third argument to get_latest tag must be 'as'" return LatestContentNode(bits[1], bits[2], bits[4]) get_latest = register.tag(get_latest) an hour and a half is a bit much... i could deal with 5-10 minutes, but at the same time, if the "Recent entries" list reads immediately... so should the rest of the site --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
time it takes django to read database?
following another tutorial to build a blog (webmonkey.com's) at it was rather frustrating to see nothing show up after creating a new blog... the admin section seems to see these right away, as they are there as soon as you hit save. But it seems to take the one section 10-20(or more?) minutes to read that they are there, while another section on the same page (that lists the items by title) no time at all. though when I update something that is listed already in the main section (the area that takes a while to get new info) it gets updated immediately... such as the title or entry http://kennethdavid.net/mysite/blog/ most likely if you look within 5-10 minutes you'll see how there are three entry titles, and two blogs... i'll go ahead and add another entry, so at the very least there will be 4 titles and three available entries... what would possibly cause this? --~--~-~--~~~---~--~~ 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: ImportError: Could not import settings 'djangoblog.settings' (Is it on sys.path? Does it have syntax errors?): No module named djangoblog.settings
nevermind. I've borked the server messing around again :) On Dec 5, 4:19 pm, garagefan <[EMAIL PROTECTED]> wrote: > http://www.kennethdavid.net/djangoblog/admin/ > getting this error on my admin page. just started working w/ > webmonkey.com's > tutorialhttp://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First... > > this is occurring after installing the tagging module... which > including me needing to install python-devel as well as using Eric's > fix (third to > bottom):http://code.google.com/p/django-tagging/issues/detail?id=110 > to get around the issue i'm seeing on my site now. > > my /etc/httpd/conf.d/python.conf file looks like this: > > LoadModule python_module modules/mod_python.so > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE djangoblog.settings > PythonOption django.root /djangoblog > PythonDebug On > > > on the godaddy virtual server my site directory, per site: > > /home/kdwadmin > > w/ djangoblog being a directory within there. I'm wondering if the > tagging module is causing this issue? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ImportError: Could not import settings 'djangoblog.settings' (Is it on sys.path? Does it have syntax errors?): No module named djangoblog.settings
http://www.kennethdavid.net/djangoblog/admin/ getting this error on my admin page. just started working w/ webmonkey.com's tutorial http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App this is occurring after installing the tagging module... which including me needing to install python-devel as well as using Eric's fix (third to bottom): http://code.google.com/p/django-tagging/issues/detail?id=110 to get around the issue i'm seeing on my site now. my /etc/httpd/conf.d/python.conf file looks like this: LoadModule python_module modules/mod_python.so SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE djangoblog.settings PythonOption django.root /djangoblog PythonDebug On on the godaddy virtual server my site directory, per site: /home/kdwadmin w/ djangoblog being a directory within there. I'm wondering if the tagging module is causing this issue? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
issues with .96 tutorial
I've recently set up a virtual server w/ godaddy and followed http://www.howtoforge.com/how-to-install-django-on-fedora9-apache2-mod_python to install django. I'm following the tutorial and am up to setting up the admin section and configuring the urls.py for the polls model. this is what is happening when i uncomment the line it says to. http://kennethdavid.net/kdwCode/admin/ i'm using kdwCode instead of mysite, and have been through out the tutorial. I'm pretty much new to running my own server, and obviously to python and django. Everything has been, thus far, set up as per the tutorial. http://www.djangoproject.com/documentation/0.96/tutorial02/ thanks in advance 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---