Re: Trouble overriding registration templates
btw, I was correct, it was the development settings causing the problem On Wed, Jul 13, 2011 at 1:43 PM, Joshua Russowrote: > Correct > > -- > 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/-/K5yKllF_gPcJ. > > 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: Issues with ManyToManyField
Thanks a lot! That worked. On Tue, Jul 19, 2011 at 9:22 PM, Nanwrote: > > Try unique_together on employee and team in the TeamMember model -- it > will throw an error if you try to add a record with the same employee > and team as another. > > On Jul 19, 7:27 pm, Felipe Spychalski wrote: >> Hello, >> >> I'm having an issue with my schema and the admin interface where I got >> 2 tables with a ManyToMany relationship: Employee and Team. >> The problem is I'm able to add one Employee to the same Team twice. >> Is there a way to prevent this from happening? Adding 'unique' to the >> Employee FK makes it so Employees can only join one Team). >> >> The code I'm using (irrelevant parts removed): >> >> from django.db import models >> from django.contrib.auth.models import User >> >> class Employee(models.Model): >> name = models.CharField(max_length=30, unique=True) >> user = models.ForeignKey(User) >> >> class Team(models.Model): >> name = models.CharField(max_length=60) >> members = models.ManyToManyField('Employee', blank=True, >> through='TeamMember') >> >> class TeamMember(models.Model): >> employee = models.ForeignKey(Employee) >> team = models.ForeignKey(Team) >> is_leader = models.BooleanField('Is Leader?') >> >> Thanks 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-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: __unicode__() addition not working in basic poll application.
Hello, I just started using django two days ago. I tried your method and >>> p=Poll.objects.all()[0] >>> p #results in >>> type(p) #results in >>> dir(p) #gives an error ['DoesNotExist', 'MultipleObjectsReturned', '__class__', '__delattr__' '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '_hash__', '__init__', '__metaclass__', '__module__', '__ne__', '__new__, '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof_', '__str__', '__subclasshook__', '__weakref__', '_base_manager', '_deault_manager', '_deferred', '_get_FIELD_display', '_get_next_or_previos_by_FIELD', '_get_next_or_previous_in_order', '_get_pk_val', '_get_unque_checks', '_meta', '_perform_date_checks', '_perform_unique_checks' '_set_pk_val', '_state', '_unicode_', 'choice_set', 'clean', 'clean_felds', 'date_error_message', 'delete', 'full_clean', 'get_next_by_pub_ate', 'get_previous_by_pub_date', 'id', 'objects', 'pk', 'prepare_dataase_save', 'pub_date', 'question', 'save', 'save_base', 'serializable_alue', 'unique_error_message', 'validate_unique'] - >>> p =Poll.objects.all() >>> for x in p: . . .print x (indent this line four spaces, hit return key once) . . . (hit return key again) #results in Poll object --- help 0_0 On Jun 14, 9:55 pm, Micky Hulsewrote: > On Tue, Jun 14, 2011 at 11:01 AM, Kyle Latham wrote: > Poll.objects.all() > > [] > > What do you get when you try: > > >>> p =Poll.objects.all()[0] > >>> p > >>> type(p) > >>> dir(p) > > Try this too: > > >>> p =Poll.objects.all() > >>> for x in p: > > . . . print x (indent this line four spaces, hit return key once) > . . . (hit return key again) > > Does any of that help? > > Good luck! > > Cheers, > Micky -- 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: DeprecationWarning displayed in test, not in dev
On Tue, Jul 19, 2011 at 11:53 PM, Tom Evanswrote: > Hi all > > I recently upgraded one of my apps to the next iteration. This used a > third party library, which started spewing out DeprecationWarning > messages when I deployed it to the test site. None of these warnings > appeared when I was developing, and I was wondering if there was a > reason why. The only noticeable difference I can see between the two > is that I use python 2.7 in development, and 2.5 in test/production - > dev is on my laptop, where as the others are on dedicated boxes. The problem here actually lies with Python. For some reason, Python 2.7 changed the reporting behavior of Warnings so that DeprecationWarning is ignored by default [1]. So, because you're developing in Python 2.7, you don't see the warnings by default; in production, where you're using Python 2.5, you do. [1] http://docs.python.org/library/warnings.html#warning-categories Yours, Russ Magee %-) -- 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: defining model with list of foreign keys?
I will have a look in the docs for this. The less thinking I have to do, the better! :) Thanks. On 7/19/11, Nanwrote: > > Try a ManyToManyField, which essentially creates the article_devices > table but abstracts it away so you don't have to think about it. > > On Jul 19, 7:52 pm, Alex Hall wrote: >> Hello all, >> I am trying to figure out the best way to represent a field in a >> model. The model is an article, which is associated with multiple >> devices (devices is another model). When adding a new article, an >> admin is presented with a multiple select list of all the rows in the >> devices table. All selections should then be stored in the article's >> "devices" field. What should this "devices" field be, though? It has >> to represent a bunch of primary keys in the devices table, which >> sounds like a comma-separated list, but it also has to be of type >> ForeignKey. Is there a way to do this, or am I better off just making >> a model for article_devices, with pk article_id and a foreign key into >> the devices table (so the article_devices table has a composite key of >> [article_id, device_id])? I hope I explained that well enough. Thanks. >> >> -- >> Have a great day, >> Alex (msg sent from GMail website) >> mehg...@gmail.com;http://www.facebook.com/mehgcap > > -- > 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. > > -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- 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: Issues with ManyToManyField
Try unique_together on employee and team in the TeamMember model -- it will throw an error if you try to add a record with the same employee and team as another. On Jul 19, 7:27 pm, Felipe Spychalskiwrote: > Hello, > > I'm having an issue with my schema and the admin interface where I got > 2 tables with a ManyToMany relationship: Employee and Team. > The problem is I'm able to add one Employee to the same Team twice. > Is there a way to prevent this from happening? Adding 'unique' to the > Employee FK makes it so Employees can only join one Team). > > The code I'm using (irrelevant parts removed): > > from django.db import models > from django.contrib.auth.models import User > > class Employee(models.Model): > name = models.CharField(max_length=30, unique=True) > user = models.ForeignKey(User) > > class Team(models.Model): > name = models.CharField(max_length=60) > members = models.ManyToManyField('Employee', blank=True, > through='TeamMember') > > class TeamMember(models.Model): > employee = models.ForeignKey(Employee) > team = models.ForeignKey(Team) > is_leader = models.BooleanField('Is Leader?') > > Thanks 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-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: defining model with list of foreign keys?
Try a ManyToManyField, which essentially creates the article_devices table but abstracts it away so you don't have to think about it. On Jul 19, 7:52 pm, Alex Hallwrote: > Hello all, > I am trying to figure out the best way to represent a field in a > model. The model is an article, which is associated with multiple > devices (devices is another model). When adding a new article, an > admin is presented with a multiple select list of all the rows in the > devices table. All selections should then be stored in the article's > "devices" field. What should this "devices" field be, though? It has > to represent a bunch of primary keys in the devices table, which > sounds like a comma-separated list, but it also has to be of type > ForeignKey. Is there a way to do this, or am I better off just making > a model for article_devices, with pk article_id and a foreign key into > the devices table (so the article_devices table has a composite key of > [article_id, device_id])? I hope I explained that well enough. Thanks. > > -- > Have a great day, > Alex (msg sent from GMail website) > mehg...@gmail.com;http://www.facebook.com/mehgcap -- 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.
defining model with list of foreign keys?
Hello all, I am trying to figure out the best way to represent a field in a model. The model is an article, which is associated with multiple devices (devices is another model). When adding a new article, an admin is presented with a multiple select list of all the rows in the devices table. All selections should then be stored in the article's "devices" field. What should this "devices" field be, though? It has to represent a bunch of primary keys in the devices table, which sounds like a comma-separated list, but it also has to be of type ForeignKey. Is there a way to do this, or am I better off just making a model for article_devices, with pk article_id and a foreign key into the devices table (so the article_devices table has a composite key of [article_id, device_id])? I hope I explained that well enough. Thanks. -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- 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: Json and django.contrib.auth.views.login
You're trying to call json_command when the view is actually named json_send_command. Cheers, AT On 7/19/11, Kevin Anthonywrote: > i'm trying to use JSON on a website that also has a HTML frontend, but > when i enable this line in urls.py > url(r'^json/sendcommand/','rchip.views.json_send_command'), > > i get this message > Caught ViewDoesNotExist while rendering: Tried json_command in module > rchip.views. Error was: 'module' object has no attribute > 'json_command' > > this is my login URL: > url(r'^accounts/login/$','django.contrib.auth.views.login', > {'template_name': 'main/login.html', }), > > -- > Thanks > Kevin Anthony > www.NoSideRacing.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. > > -- Sent from my mobile device -- 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.
Issues with ManyToManyField
Hello, I'm having an issue with my schema and the admin interface where I got 2 tables with a ManyToMany relationship: Employee and Team. The problem is I'm able to add one Employee to the same Team twice. Is there a way to prevent this from happening? Adding 'unique' to the Employee FK makes it so Employees can only join one Team). The code I'm using (irrelevant parts removed): from django.db import models from django.contrib.auth.models import User class Employee(models.Model): name = models.CharField(max_length=30, unique=True) user = models.ForeignKey(User) class Team(models.Model): name = models.CharField(max_length=60) members = models.ManyToManyField('Employee', blank=True, through='TeamMember') class TeamMember(models.Model): employee = models.ForeignKey(Employee) team = models.ForeignKey(Team) is_leader = models.BooleanField('Is Leader?') Thanks 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-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: Json and django.contrib.auth.views.login
No, it's there def json_send_command(request,command_in=None,command_text_in=None,source_in=None,method_in=None): and it works, if i navigate to mysite.com/json/sendcommand/ i get the correct message telling me i didn't supply a command On Tue, Jul 19, 2011 at 6:29 PM, Andre Terrawrote: > Kevin, > > Please open your views.py module located inside the rchip module and > you will see there is no view named json_send_command. > > Please refer to that app's documentation to find more about the > correct setup for your urls. > > Cheers, > AT > > On 7/19/11, Kevin Anthony wrote: >> i'm trying to use JSON on a website that also has a HTML frontend, but >> when i enable this line in urls.py >> url(r'^json/sendcommand/','rchip.views.json_send_command'), >> >> i get this message >> Caught ViewDoesNotExist while rendering: Tried json_command in module >> rchip.views. Error was: 'module' object has no attribute >> 'json_command' >> >> this is my login URL: >> url(r'^accounts/login/$','django.contrib.auth.views.login', >> {'template_name': 'main/login.html', }), >> >> -- >> Thanks >> Kevin Anthony >> www.NoSideRacing.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. >> >> > > -- > Sent from my mobile device > > -- > 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. > > -- Thanks Kevin Anthony www.NoSideRacing.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: Json and django.contrib.auth.views.login
Kevin, Please open your views.py module located inside the rchip module and you will see there is no view named json_send_command. Please refer to that app's documentation to find more about the correct setup for your urls. Cheers, AT On 7/19/11, Kevin Anthonywrote: > i'm trying to use JSON on a website that also has a HTML frontend, but > when i enable this line in urls.py > url(r'^json/sendcommand/','rchip.views.json_send_command'), > > i get this message > Caught ViewDoesNotExist while rendering: Tried json_command in module > rchip.views. Error was: 'module' object has no attribute > 'json_command' > > this is my login URL: > url(r'^accounts/login/$','django.contrib.auth.views.login', > {'template_name': 'main/login.html', }), > > -- > Thanks > Kevin Anthony > www.NoSideRacing.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. > > -- Sent from my mobile device -- 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.
Django - change select items display
I use ModelForm. One of fields is: repertoire = models.ForeignKey(Repertoire) I need to change it's display type. Instead of using *unicode* in display I want to show name and date of repertoire. How in ModelForm I can do that? -- 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/-/M4Lfow9YmGMJ. 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.
Json and django.contrib.auth.views.login
i'm trying to use JSON on a website that also has a HTML frontend, but when i enable this line in urls.py url(r'^json/sendcommand/','rchip.views.json_send_command'), i get this message Caught ViewDoesNotExist while rendering: Tried json_command in module rchip.views. Error was: 'module' object has no attribute 'json_command' this is my login URL: url(r'^accounts/login/$','django.contrib.auth.views.login', {'template_name': 'main/login.html', }), -- Thanks Kevin Anthony www.NoSideRacing.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.
telling Django to recognize a different application root url
I am deploying my Django projects on a host where I have the following kinds of URLs: http://yrl.hostname.com/djangoproject1 http://yrl.hostname.com/djangoproject2 Then, let's say I also make app A for project 1 and app B for project 2. http://yrl.hostname.com/djangoproject1/appA/ http://yrl.hostname.com/djangoproject2/appB/ Apps A and B are unrelated and I don't want to squish them under the same project. My problem is that when I use any of Django's batteries-included functionalities, like the Admin site and the Comments framework, Django is using links like: http://yrl.hostname.com/admin/ instead of: http://yrl.hostname.com/djangoproject1/admin/ In other words, I need a way to tell Django that my project root URL is "/project1/" instead of the default "/". Is there any way to do this? Thanks, Yiping -- 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: Proper way to strip whitespace from Charfields in a form in current version of Django?
Why not add a custom clean_fieldname method to your class? Perhaps you could dig into the original BaseModelForm and see how it constructs validation, and override whatever is needed. I'm on my phone atm, so I'll let you do the footwork alone, at least for now. Cheers, AT On 7/19/11, brwrote: > There seems to be a raging and unresolved discussion about how to > address the issue of stripping whitespace from form fields in future > versions of Django over on the Developers group: > http://groups.google.com/group/django-developers/browse_thread/thread/90352cc0da78390b > . > > In the present, what is the proper place to strip whitespace? > > I've starting down this path: > > http://www.peterbe.com/plog/automatically-strip-whitespace-in-django-forms > > by setting up a BaseModelForm class, but i don't necessarily like the > fact that I could have a field with "blank=False" that will still > validate if you have an input of just whitespace, since apparently > "clean" gets called after validation takes place. Is the override of > full_clean referenced in the comments the way around this then? Seems > pretty hacky. > > Thanks > > Ben > > -- > 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. > > -- Sent from my mobile device -- 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: Pasta root
Are you using a context processor to pass MEDIA_URL to the template? How are you serving your static files? Have you setup your server correctly, or configured django to serve them? Finally, please post in English so that everyone can understand your question, not only for the sake of helping, but also so that others might learn from the answers as well. Best regards, Andre Terra On 7/19/11, Jussiê Vieira Toledowrote: > E ae galera! > > Estou tentando carregar um css para uma página, mas no caminho não > estou acertando. > Como vejo qual é a minha pasta root? > > Por exemplo estou tentando desta duas formas: > 1 - type="text/css" /> > onde MEDIA_URL = '/media/' e > MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, 'media') > > e 2 - > type="text/css" /> > onde a pasta "cida" seria onde eu dei o startproject > > Valeu ae galera, > > -- > 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. > > -- Sent from my mobile device -- 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: static urls
Try use ../ in CSS files If you are using one CSS by app. Or /static/ if you are using just one CSS for all apps :D On Tue, Jul 19, 2011 at 3:29 AM, Anoop Thomas Mathewwrote: > Hi, > > Depends on how you configured STATIC_URL in settings. If / is there in the > STATIC_URL, then no need to add it. > Add it with STATIC_URLS, that is the standard practice. > > regards, > > Anoop > atm > ___ > Life is short, Live it hard. > > > > > > On 19 July 2011 11:31, NISA BALAKRISHNAN wrote: > >> i am new to django >> >> @import "{{STATIC_URL}}/css/demo_page.css"; >> >> the slash after {{STATIC_URL}} is needed? what is the actual usage ? >> >> -- >> 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. > -- Valder Gallo +55 41 3206-9349 +55 41 9658-9349 @valdergallo www.valdergallo.com.br -- 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 get parent id in inline html
Hi all, I've customized edit_inline.html for my inline section. I need parent model's id/pk in the inline template. How can I get it? Is there any way to reach it? -- 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.
Pasta root
E ae galera! Estou tentando carregar um css para uma página, mas no caminho não estou acertando. Como vejo qual é a minha pasta root? Por exemplo estou tentando desta duas formas: 1 - onde MEDIA_URL = '/media/' e MEDIA_ROOT = os.path.join(PROJECT_ROOT_PATH, 'media') e 2 - onde a pasta "cida" seria onde eu dei o startproject Valeu ae galera, -- 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.
Django + nginx + windows
Hello, guys I just wanted to share: Setting up django + flup + fcgi + nginx on windows couldn't be any easier. Talk about "it just works"!! Honestly, it took me about 5 minutes to set everything up, including downloading the files. I merged the suggested .conf file from https://code.djangoproject.com/wiki/ServerArrangements to the default nginx.conf file, changed a couple of ports and paths, ran manage.py runfcgi and it simply worked :O I recommend all of you who haven't given it a chance, to try it out for some small app or even for development. Cheers, A very happy André Terra -- 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.
Scientific Linux with django running through apache and fastcgi
here is my problem.. After trying to run on localhost/hello/ through lynx I get a 500. This is what htttpd error_log file prints out. I am not using socks, i am using tcp host port 3303. [Tue Jul 19 13:23:16 2011] [error] [client 127.0.0.1] (13)Permission denied: FastCGI: failed to connect to server "/var/www/html/ mysite.fcgi": connect() failed [Tue Jul 19 13:23:16 2011] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/var/www/html/ mysite.fcgi" I'm not sure if its a permission problem or SELinux issue. fcgi is working by itself without apache look at it here. FCGI TestApp FCGI TestApprequest count = 1pid = 25838CVS_RSH : ssh DISPLAY : localhost:12.0 G_BROKEN_FILENAMES : 1 HISTSIZE : 1000 HOME : /root HOSTNAME : INPUTRC : /etc/inputrc KDEDIR : /usr KDE_IS_PRELINKED : 1 KDE_NO_IPV6 : 1 LANG : en_US.UTF-8 LESSOPEN : |/usr/bin/lesspipe.sh %s LOGNAME : root LS_COLORS: no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: MAIL : /var/spool/mail/root OLDPWD : /root PATH : /usr/kerberos/sbin:/usr/kerberos/bin:/ usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin PWD : /var/www/html SHELL: /bin/bash SHLVL: 1 SSH_ASKPASS : /usr/libexec/openssh/gnome-ssh-askpass SSH_CLIENT : 192.208.139.76 3756 22 SSH_CONNECTION : SSH_TTY : /dev/pts/3 TERM : vt100 USER : root _: /usr/local/bin/python Cheers -- 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 up Django with fastCGI on centos with apache
here is my problem.. After trying to run on localhost/hello/ through lynx I get a 500. This is what htttpd error_log file prints out. I am not using socks, i am using tcp host port 3303. [Tue Jul 19 13:23:16 2011] [error] [client 127.0.0.1] (13)Permission denied: FastCGI: failed to connect to server "/var/www/html/ mysite.fcgi": connect() failed [Tue Jul 19 13:23:16 2011] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/var/www/html/ mysite.fcgi" I'm not sure if its a permission problem or SELinux issue. fcgi is working by itself without apache look at it here. FCGI TestApp FCGI TestApprequest count = 1pid = 25838CVS_RSH : ssh DISPLAY : localhost:12.0 G_BROKEN_FILENAMES : 1 HISTSIZE : 1000 HOME : /root HOSTNAME : INPUTRC : /etc/inputrc KDEDIR : /usr KDE_IS_PRELINKED : 1 KDE_NO_IPV6 : 1 LANG : en_US.UTF-8 LESSOPEN : |/usr/bin/lesspipe.sh %s LOGNAME : root LS_COLORS: no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: MAIL : /var/spool/mail/root OLDPWD : /root PATH : /usr/kerberos/sbin:/usr/kerberos/bin:/ usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin PWD : /var/www/html SHELL: /bin/bash SHLVL: 1 SSH_ASKPASS : /usr/libexec/openssh/gnome-ssh-askpass SSH_CLIENT : 192.208.139.76 3756 22 SSH_CONNECTION : SSH_TTY : /dev/pts/3 TERM : vt100 USER : root _: /usr/local/bin/python Cheers mate. On Jul 19, 11:19 am, Tom Evanswrote: > On Tue, Jul 19, 2011 at 5:05 PM, Rick Beacham wrote: > > thanks for the info. I corrected the this but i'm still having issues. > > My crystal ball is out of order, could you specify the issues please. > > Cheers > > Tom -- 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.
Manually ordering items in relation to siblings
Hello, everyone Assume the following models (dpaste.com [1]): class Account(models.Model): """ Account model for categorizing entries from each SAP import, and eventually sorting, grouping, filtering data. """ code = models.CharField(max_length=255, primary_key=True) group = models.ForeignKey('AccountGroup', blank=True, null=True, related_name='groups') description = models.CharField(max_length=512, blank=True, null=True) class AccountGroup(models.Model): name = models.CharField(max_length=512, blank=True, null=True, verbose_name=_('Name')) parent = models.ForeignKey('AccountGroup', blank=True, null=True, related_name='children') is_subgroup = models.BooleanField(default=False, editable=False) def save(self, *args, **kwargs): self.is_subgroup = False if self.parent is not None: self.is_subgroup = True return super(AccountGroup, self).save(*args, **kwargs) I would like to be able to manually specify an order for AccountGroups in relation to their siblings, so that I can have a final result of something like the following pic (which describes a set of groups and accounts, with the latter being the rightmost, M0-format codes. http://img200.imageshack.us/img200/9423/groupsandaccounts.png As you can see from the picture, accounts can be located under any number of groups, and neither Accounts nor AccountGroups are not sorted naturally. Short of using something like django-treebeard[3], how can I write a solution for this use case? Thanks in advance for all your help! Cheers, André Terra [1] http://dpaste.com/hold/571566/ [2] https://docs.djangoproject.com/en/dev/ref/models/fields/#commaseparatedintegerfield [3] https://tabo.pe/projects/django-treebeard/docs/1.52/ -- 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: MemoryError on insert_query
Thanks Tom settings.DEBUG was True, now False and all well Thanks again Thanos trades done 75 in 3640.7334 trades done 751000 in 3645.2171 trades done 751812 in 3649.1547 (6711, 6732, 751812) On Jul 19, 11:56 am, Tom Evanswrote: > On Tue, Jul 19, 2011 at 4:33 PM, thanos wrote: > > os: win32 > > db: oracle 10 > > django: 1.3 > > python: 2.7 > > > While inserting around 750K of records I get the following error > > settings.DEBUG is True or False? > > If True, it will store a log of every query and statistics about that > query in django.db.connection.queries. IE, with settings.DEBUG, you > will have a (deliberate) memory leak until the connection is > destroyed. > > Cheers > > Tom -- 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: : Multipoint field only shows the first point in OSMAdmin
Ok, I just tried with the dev version of OpenLayers and it just works! The problem comes from openlayers not interpreting correctly GeoDjango's WKT syntax more here: http://trac.osgeo.org/openlayers/ticket/2670 My workaround is the following: - checkout a dev version of openlayers - build it and make it reachable anywhere on the internet - edit django/contrib/gis/admin/options.py and update openlayers_url to your own url Hope this can help someone else On Jul 19, 11:29 am, sylvain_grodeswrote: > Hello, today I'm facing a problem which coud be a Geodjango/OpenLayer > or Django. > > How to reproduce: > > * in your model create a class: > > from django.contrib.gis.db import models > > class Track(models.Model): > track = models.MultiPointField(srid=4326) > > * in your admin.py add: > admin.site.register(Track, OSMGeoAdmin) > > * create a track object with the shell > from django.contrib.gis.geos import MultiPoint > from django.contrib.gis.geos import Point > > myTrack = Track() > point1 = Point(-61.067853, 14.607004) > point2 = Point(-61.063573, 14.609091) > multi = MultiPoint(point1, point2) > > myTrack.track = multi > > multi.save() > > * look in the administrator: you will see only one point even if in > the source i can read MULTIPOINT( > > Anyone has already seen this? > > Am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Setting up Django with fastCGI on centos with apache
On Tue, Jul 19, 2011 at 5:05 PM, Rick Beachamwrote: > thanks for the info. I corrected the this but i'm still having issues. > My crystal ball is out of order, could you specify the issues please. Cheers Tom -- 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 up Django with fastCGI on centos with apache
thanks for the info. I corrected the this but i'm still having issues. On Fri, Jul 15, 2011 at 2:35 PM, ionic drivewrote: > Hello Rick, > > Address already in use, tells you that on 127.0.0.1 specific port 8000 > already a process is running. I guess you have your Apache already > running their, right!? > > you have to listen with your Apache to the proper port where fastcgi is > serving the data for Apache. I think you have to re-read the tutorial > you are working on. > > Good luck! > Ionic > Electronics Platform > http://develissimo.com > > > On Fri, 2011-07-15 at 12:06 -0700, Rick Beacham wrote: > > I'm having alot of trouble with setting up django with fastCGI. I was > > able to use the default test server made with django no problem. But > > I'm having trouble setting it up with httpd and fastCGI in scientific > > linux(centos).. Here is the error message after running this > > command ./manage.py runfcgi daemonize=false host=127.0.0.1 > > port=8000 . > > > > > > > > > > > > Traceback (most recent call last): > > File "./manage.py", line 14, in > > execute_manager(settings) > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/ > > management/__init__.py", line 438, in execute_manager > > utility.execute() > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/ > > management/__init__.py", line 379, in execute > > self.fetch_command(subcommand).run_from_argv(self.argv) > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/ > > management/base.py", line 191, in run_from_argv > > self.execute(*args, **options.__dict__) > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/ > > management/base.py", line 220, in execute > > output = self.handle(*args, **options) > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/ > > management/commands/runfcgi.py", line 16, in handle > > runfastcgi(args) > > File "/opt/python2.7/lib/python2.7/site-packages/django/core/servers/ > > fastcgi.py", line 180, in runfastcgi > > WSGIServer(WSGIHandler(), **wsgi_opts).run() > > File "build/bdist.linux-x86_64/egg/flup/server/fcgi_fork.py", line > > 131, in run > > File "build/bdist.linux-x86_64/egg/flup/server/fcgi_base.py", line > > 1018, in _setupSocket > > File "/opt/python2.7/lib/python2.7/socket.py", line 222, in meth > > return getattr(self._sock,name)(*args) > > socket.error: [Errno 98] Address already in use > > > > > -- > 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. > > -- Green dreams sleep roughly. -- 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: MemoryError on insert_query
On Tue, Jul 19, 2011 at 4:33 PM, thanoswrote: > os: win32 > db: oracle 10 > django: 1.3 > python: 2.7 > > > While inserting around 750K of records I get the following error > settings.DEBUG is True or False? If True, it will store a log of every query and statistics about that query in django.db.connection.queries. IE, with settings.DEBUG, you will have a (deliberate) memory leak until the connection is destroyed. Cheers Tom -- 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.
DeprecationWarning displayed in test, not in dev
Hi all I recently upgraded one of my apps to the next iteration. This used a third party library, which started spewing out DeprecationWarning messages when I deployed it to the test site. None of these warnings appeared when I was developing, and I was wondering if there was a reason why. The only noticeable difference I can see between the two is that I use python 2.7 in development, and 2.5 in test/production - dev is on my laptop, where as the others are on dedicated boxes. In both cases, the required packages are installed into a virtualenv via pip from a requirements file, so the environment can be wiped out and re-created, which I did on both dev and test, without changing the end result. So, in dev: > $ md5 ../environ/src/django-postgresql-netfields/netfields/fields.py MD5 (../environ/src/django-postgresql-netfields/netfields/fields.py) = 3ad794d519a1328b1587a9f604324888 > $ python manage.py shell Python 2.7.1 (r271:86832, Dec 13 2010, 15:52:15) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd8 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import django >>> django.VERSION (1, 3, 0, 'final', 0) In test: > $ md5 ../environ/lib/python2.5/site-packages/netfields/fields.py MD5 (../environ/lib/python2.5/site-packages/netfields/fields.py) = 3ad794d519a1328b1587a9f604324888 > $ python manage.py shell .../environ/lib/python2.5/site-packages/netfields/fields.py:8: DeprecationWarning: A Field class whose get_db_prep_lookup method hasn't been updated to take `connection` and `prepared` arguments. class _NetAddressField(models.Field): .../environ/lib/python2.5/site-packages/netfields/fields.py:8: DeprecationWarning: A Field class whose get_db_prep_value method hasn't been updated to take `connection` and `prepared` arguments. class _NetAddressField(models.Field): .../environ/lib/python2.5/site-packages/django/db/models/fields/subclassing.py:80: DeprecationWarning: A Field class whose db_type method hasn't been updated to take a `connection` argument. new_class = super(SubfieldBase, cls).__new__(cls, name, bases, attrs) .../environ/lib/python2.5/site-packages/netfields/fields.py:86: DeprecationWarning: A Field class whose db_type method hasn't been updated to take a `connection` argument. class MACAddressField(models.Field): Python 2.5.2 (r252:60911, Apr 25 2008, 17:25:09) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd7 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import django >>> django.VERSION (1, 3, 0, 'final', 0) The actual warning isn't an issue, I can update the library to fix that, I'm more concerned why I am not seeing the warnings in development. Cheers Tom -- 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: using signals to add users to a group
Hi Shawn, I've pasted the traceback below, I need to write some more tests to give you better information. Andrew $ python manage.py test user_management Creating test database for alias 'default'... ..F == FAIL: test_user_added_to_appropriate_group (user_management.tests.SignalTest) -- Traceback (most recent call last): File "/home/amarder/Documents/sql_mangrove/nmis/user_management/ tests.py", line 39, in test_user_added_to_appropriate_group self.assertTrue(technical_assistants in allen.groups.all()) AssertionError: False is not true -- Ran 3 tests in 1.319s FAILED (failures=1) Destroying test database for alias 'default'... On Jul 18, 1:02 pm, Shawn Milochikwrote: > What traceback do you get? -- 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: Accounting app - design decisions needed
On Tue, Jul 19, 2011 at 1:13 AM, Andre Terrawrote: > Marc, > > First of all, thank you for your insights. I'll try to clarify things as > best as I can. > > On Mon, Jul 18, 2011 at 7:21 PM, Marc Aymerich wrote: > >> >> >> On Mon, Jul 18, 2011 at 10:54 PM, Andre Terra wrote: >> >>> Hello, django-users. >>> >>> I'm in need of some serious help on deciding how to design my next >>> project. Below is my attempt to describe the use case: >>> >>> *USE CASE* >>> I'm writing an accounting app that will be generating unique monthly >>> reports of the revenue results for a list of Accounts (model) in the >>> company. >>> >>> Each Account has a set of instances of Entry (model) with a Decimal >>> value, date and some text, as well as a FK to Account. >>> >>> These entries are uploaded through an (already coded) import function >>> which parses a .csv and, using DSE, inserts 1.5 million rows to the Entry >>> table. These entries also have an FK to Task (model) so I know which import >>> process generated them. >>> >>> Each month I want to allow an admin to pick a set of Accounts to be >>> displayed in the monthly report, which needs to be unique for obvious >>> reasons. >>> >>> *CODE >>> models.py >>> *http://dpaste.com/hold/570933/ >>> >>> *example .csv file to be imported* (importing the file is already coded >>> and works 100% so far)* >>> *http://dpaste.com/hold/570934/* >>> * >>> *QUESTIONS* >> >> 1. Should I create another model named MonthlyReport with an M2M relation >>> to Accounts, and then add an 'is_active' flag so I know which one is the >>> official monthly report? >> >> >> Hi Andre, Could you elaborate a little more about the monthly reports? >> The admin pick up some arbitrary number of accounts and the app generates >> a global report for those accounts? or it should generate a discret report >> for each account? >> > > Currently, there are about 200 accounts, but the entries for every month > only refer to a subset of them (about 50 each month). However, the entries > can refer to accounts that weren't referenced on the previous months, > including new accounts. Moreover, even though the entries refer to say, 50 > accounts, the admin might only want to show the report for 40, or perhaps > display an extra account (that didn't get imported) with a hard coded value. > They might also want to manually enter a value for any account, if, for > example, something was missing in the original .csv or if the total value > was wrong. > > Monthly Account values are derived from a sum of all the entries' values > that have an FK to that account in a given month. > > Entries are 1.5 million rows/month, with small values, and accounts are > referenced hundreds of times in the .csv file, with the same date, user and > sometimes text. The value can vary, but not necessarily. So I do some > aggregation in the entries to get the account value. > > These accounts are "groups" of entries that for accounting purpose have > been given a code. Think of it as a way of grouping different account > payables/receivables, so you have, say code M1023910240 for "subscriptions" > (+), D102512509 for "discounts" (-), M91212050592 for "SMS usage". > >> 2. If so, how can I ensure there's only one official monthly report? >>> Perhaps setting is_active to False to all the other MonthlyReports that >>> carry the same month/year? >>> >> >> what's the difference between "official monthly report" and "unofficial" >> monthly record? >> > > I wanted admins to be able to draft the report and have a final, published > report to go on the main page (this one would need to be unique for > month/year), so that they can switch back and forth between versions. > I think that a MonthlyReport model with a M2M to accounts is the way to go. I propose 2 ways of affort this: 1) There is an app called django-reversion that allows you to have some kind of version control system for your models. The admin can be able to recover any previous version of your objects, also recover deleted objects. So if you use this approach, you only have one report per month in your MonthlyReport, and this report per month is the official one. So the drafts are stored by django-reversion. But, frankly, I don't know how performance will be with 1.5million entries. 2) As you say, use a MonthlyReport model with an is_official flag, and when the admin select the accounts in order to do the current report display a dinamic form with a single field (RadioWidget would be the most appropiated). So this dynamic form should looks like: (if there is no official report for the current month the form should ask:) *Create a new dratf *Create a new official (otherweis:) *Create a new draft *Override current oficial report >> >>> 3. How should I prevent users from importing the Entries more than once? >>> Forcing a deletion of entries for the same month as the imported entries is >>> a possible solution.. The
MemoryError on insert_query
os: win32 db: oracle 10 django: 1.3 python: 2.7 While inserting around 750K of records I get the following error trades done 661000 in 4007.3089 trades done 662000 in 4011.9012 Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) File "c:\python27\lib\site-packages\django\core\management \__init__.py", line 438, in execute_manager utility.execute() File "c:\python27\lib\site-packages\django\core\management \__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "c:\python27\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "c:\python27\lib\site-packages\django\core\management\base.py", line 220, in execute output = self.handle(*args, **options) File "F:\work\control\src\control\migration\management\commands \convert.py", line 33, in handle print conversion.execute() File "F:\work\control\src\control\..\control\migration\models.py", line 341, in execute return PROCESSOR(self, **kwa) File "F:\work\control\src\control\staging\models.py", line 96, in extract trade.save() File "c:\python27\lib\site-packages\django\db\models\base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "c:\python27\lib\site-packages\django\db\models\base.py", line 553, in save_base result = manager._insert(values, return_id=update_pk, using=using) File "c:\python27\lib\site-packages\django\db\models\manager.py", line 195, in _insert return insert_query(self.model, values, **kwargs) File "c:\python27\lib\site-packages\django\db\models\query.py", line 1436, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "c:\python27\lib\site-packages\django\db\models\sql \compiler.py", line 791, in execute_sql cursor = super(SQLInsertCompiler, self).execute_sql(None) File "c:\python27\lib\site-packages\django\db\models\sql \compiler.py", line 735, in execute_sql cursor.execute(sql, params) File "c:\python27\lib\site-packages\django\db\backends\util.py", line 43, in execute logger.debug('(%.3f) %s; args=%s' % (duration, sql, params), MemoryError In my code I've been careful to only use iterators, etc and should only be using enough memory for one record (around 1k). While doing inserts is there any accumulation of objects going on ? For instance is commit only occurring after n saves. here is a stripped down version. @classmethod def extract(cls, conversion, migration_run_id = 6711): """ This code is used to migrate trades from one trading system to another. """ tick = time.time() run = Job.objects.get(name=cls.JOB_NAME).start() if migration_run_id is None: migration_run_id = run.pk _, src_cursor = conversion.source_sql.execute() # getting a cursor on the source database (using sqlachemy against mssql here ) count = 0 for record in src_cursor: count +=1 fields = conversion.source_sql.source.to_dict(src_cursor, record) # justs converts a record to a dict. fields['run'] = run fields['migration_run'] = migration_run_id trade = cls(**fields) # creating a django model trade.save() # here we run out of memory after about 650,000 inserts. All records where committed before crash. if count % 1000 == 0: print 'trades done', count, 'in ', time.time() - tick print 'trades done', count, 'in ', time.time() - tick return migration_run_id, run.pk, count 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.
[GEODJANGO]: Multipoint field only shows the first point in OSMAdmin
Hello, today I'm facing a problem which coud be a Geodjango/OpenLayer or Django. How to reproduce: * in your model create a class: from django.contrib.gis.db import models class Track(models.Model): track = models.MultiPointField(srid=4326) * in your admin.py add: admin.site.register(Track, OSMGeoAdmin) * create a track object with the shell from django.contrib.gis.geos import MultiPoint from django.contrib.gis.geos import Point myTrack = Track() point1 = Point(-61.067853, 14.607004) point2 = Point(-61.063573, 14.609091) multi = MultiPoint(point1, point2) myTrack.track = multi multi.save() * look in the administrator: you will see only one point even if in the source i can read MULTIPOINT( Anyone has already seen this? Am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Odp: Re: Django admin - utf8 filename
OK I managed to do that - I can upload utf8 files now. But after uploading it i can't see file form field to change file:/ -- 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/-/dMN3ApTZEPAJ. 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.
Odp: Re: Django admin - utf8 filename
I use shared server so I think I have no access to apache settings. My language is set to 'pl' right now. -- 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/-/VhyngaodKbEJ. 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 admin - utf8 filename
Le 19 juil. 2011 à 16:32, galgal a écrit : > How can I get rid of error when uploading files with utf8 name? > I can't find any solution:/ Hi, There's nothing to do except make sure your LANG is set to something such as en_US.UTF-8. If you are using apache, check you /etc/apache2/envvars Regards, Xavier. -- 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.
Django admin - utf8 filename
How can I get rid of error when uploading files with utf8 name? I can't find any solution:/ -- 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/-/MbHzssKnwOgJ. 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 up homepage, and naming/organizing apps
Thanks for all the replies. 1. I did plan to have a dynamic homepage; its most complex section will be to display the most recent ten additions to the articles table. It sounds like I can just create a views directory inside my site directory and use that. I was hesitant to do this simply because django didn't create one, and it seems to create what I should use. That is, if it didn't give me a views folder, I figured there was some other way to do it than to use a views folder. 2. I will keep my app directory structure for now and modify as necessary. On 7/19/11, Mike Dewhirstwrote: > On 19/07/2011 1:49pm, Alex Hall wrote: >> Hello all, >> I was on this list a few months ago, but was unable to get a >> django-friendly web host. I am now helping with a site on Bluehost, >> which does support django, and I am hoping to be given permission by >> the guy in charge to use django instead of php for our project. >> >> I have been going through the tutorial, adapting it to my project as >> necessary, and have a couple questions. >> >> 1. This must be glaringly obvious, but how do I use django to load my >> homepage (index.html in the public_html root)? I understand about >> views and url matching, but there is no views.py in the main directory >> and I am not sure if I am supposed to create one or not. In other >> words, how does django know where to find the page to load when a >> visitor simply goes to mysite.com, instead of >> mysite.com/something_to_match? > > Normally you would build a dynamic home page but here is a simple > sequence ... > > 1. Write a hello world index.html which will be your "home" page > > 2. Put it in /templates where is the directory > containing settings.py > > 3. In urls.py where your other patterns exist scroll to the end and add > this ... > > # note the += which appends this pattern to the others. > urlpatterns += patterns('', > # empty string r'' matches any URL so put it last > (r'', 'flatviews.flatpage'), > ) > > 4. Create a new file flatviews.py in the directory like this ... > > from django.shortcuts import render_to_response > > def flatpage(request, pagename='index.html'): > return render_to_response(pagename) > > Should do the trick. Your mission is now to build your home page from > inherited templates and database content via the django template language. > > >> >> 2. The project I am working on has a few tables: media, articles, and >> authors. An article can have one author and one or more rows in the >> media table associated with it. I currently have an app called >> "tables", in which I plan to define the three tables in models.py (I >> am only working with authors as a test). All my views, urls, and so >> forth will be inside this tables app. Is this generally recommended, >> or should I have an app for each table? > > The layout principle as set down by James Bennet in Practical Django > Projects is to keep it simple. In other words you would begin by keeping > it all in a single app directory. > > If it starts to get complex you can refactor into separate directories > eg all views in a views directory etc. In there you can have different > files for different groups of views which might have some similarity > such as all needing to import the same particular model or models. > Models too can be split into different files in a separate models > directory. Keep stuff together which belongs together. > > Finally, he says to try and segregate your own project into separate > apps in their own directories with their own urls, models, views etc on > the basis of some sort of standalone functionality. > > My own take on this is to not worry when you are a beginner because it > will become obvious when things are getting messy and you suddenly > realise all you have to do is unclutter directories into a nice and > comfortable hierarchy. > > One example above is flatviews.py which I said to put in the > directory. If you decided that was getting too cluttered you could make > a views directory and move it into /views/flatviews.py and > refactor urls.py so it called 'views.flatviews.flatpage' > > Good luck > > Mike > >> The tutorial has two tables >> defined, but the urls are all /polls/[something], whereas my urls >> might be /authors/, /author/[id], /article/[id], and so on (not >> sharing /[app_name]/... like the tutorial does). I hope that made >> sense! >> > > -- > 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. > > -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- You received this message because you are subscribed to the Google
Re: Django site broken after Debian upgrade
Glad you got it figured out, after all! Unfortunately, the django book is indeed lacking a serious update. The official docs are still the go-to place for learning how to use django. Users in this list have been active in writing new pages to the official Wiki, but there's also a huge void in terms of how-tos and tutorials on that media. For now, what I will recommend is that you ask around in #django ( irc.freenode.net), here on django-users and on Stack Overflow (SO). FWIW, I think SO is flooded with questions about third-party apps, so I don't go there often to answer questions, as I have virtually no experience in said apps. However, if the questions you post to this list come with the right tone and a decent explanation of the issues you are encountering, most of us will be glad to jump in and lend a hand. https://code.djangoproject.com/wiki/UsingTheMailingList Sincerely, André Terra On Tue, Jul 19, 2011 at 10:24 AM, bklinewrote: > On Jul 19, 8:33 am, bkline wrote: > > > Thanks for the tip, Andre. I'll keep digging and see if I can > > extricate myself from this mess. > > Bingo! That was the problem. After clearing out the offending copied > admin templates I was able to restore the CSRF code and I'm back on > the road again. > > Thanks again. I'm glad I won't have to ditch Django. I like the > interface it provides better than anything I could have rolled myself. > > As a side note, I'm guessing that turning to the "newer" version of > The Django Book won't do me much good, as the dates on the chapter > list seem to indicate that nothing has been done since the spring of > 2009, and the book is incomplete (and out of date). > > Bob > > -- > 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: Django site broken after Debian upgrade
On Jul 19, 8:33 am, bklinewrote: > Thanks for the tip, Andre. I'll keep digging and see if I can > extricate myself from this mess. Bingo! That was the problem. After clearing out the offending copied admin templates I was able to restore the CSRF code and I'm back on the road again. Thanks again. I'm glad I won't have to ditch Django. I like the interface it provides better than anything I could have rolled myself. As a side note, I'm guessing that turning to the "newer" version of The Django Book won't do me much good, as the dates on the chapter list seem to indicate that nothing has been done since the spring of 2009, and the book is incomplete (and out of date). Bob -- 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: Accounting app - design decisions needed
On Mon, Jul 18, 2011 at 10:16 PM, Mike Dewhirstwrote: > On 19/07/2011 9:13am, Andre Terra wrote: > >> >> The problem is I'm supposed to have millions of entries; all with the same >> date, thousands for the same Account, hundreds with the same description and >> perhaps dozens with the same value. I think I'm going with force-overwrite >> for the month, at least for the time being. >> > > Seems to me you need imestamps too or you will lose data. > > Mike > > Each Entry has an FK to Task, which in itself has a timestamp, so I think that part is covered. Thank you for the input as well! AT -- 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 site broken after Debian upgrade
On Jul 18, 5:25 pm, Andre Terrawrote: > Perhaps you have a replica of the old admin templates on your > project's folder which might be overriding the files shipped with > core, so take a look at that first. This looks like a very useful clue. I set this up years ago to handle my company's financial books, and haven't touched the code since then, so I'm having to do some digging to reconstruct how I did things. Much of what I did was following the instructions from the Django Book (written, as I recall, by the creators of Django), and I see that it said in chapter 6: "To customize Django’s admin templates, simply copy the relevant stock admin template from the Django distribution into your one of the directories pointed-to by TEMPLATE_DIRS." Apparently that was dangerous advice, if it's at the root of the breakage I've run into (and I see that this advice is no longer included in the newer version of the book under development). Thanks for the tip, Andre. I'll keep digging and see if I can extricate myself from this mess. Cheers, Bob -- 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 site broken after Debian upgrade
On Jul 19, 1:13 am, Andre Terrawrote: > Like I said, installing python-django isn't canonical, but no body said it's > inherently wrong. Actually, I just paid a visit to Django's installation guide [1], which advises installing Django using the package management system of your OS distro, as the first of three recommended installation options, so I guess "canonical" might have more than one interpretation in this context. > Having said that, I wonder why [1] i'm still finding Django 1.2 as the > shipped version for the Debian's stable release. Are you running wheezy by > any chance? I'm running squeeze (see the version info I provided in my original post). Cheers, Bob [1] https://docs.djangoproject.com/en/1.3/intro/install/ -- 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: url names
On 19/07/11 11:08, NISA BALAKRISHNAN wrote: how to add url names to the following entry in urls.py. ( r'^all/synchro/download/file/', "get_all_data_download" ) Use the url function [1] url( r'^all/synchro/download/file/', "get_all_data_download", name="get_all_data_download" ) Alasdair [1] https://docs.djangoproject.com/en/dev/topics/http/urls/#url -- Alasdair Nicol Developer, MEMSET mail: alasd...@memset.com web: http://www.memset.com/ Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, Surrey, GU2 7YD, UK. -- 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: It is possible to list data from a database view in Django?
I remember there is a app in django which is called databrowse.and this is a django contrib app.It just can satify your needs .try that. 2011/7/19 Andre Lopes> Hi, > > I'm new to Django. I'm in the process of test the features of Django > to move a site from PHP to Python/Django. > > I have a database view that is the result of many joints between > tables, I only do SELECTs to this view, the data is inserted via a > Script that will populate the various tables. I only need to show the > data in this view, how Django handles the listings of data in views? I > have to define the view in the model? > > Please give me a clue. > > Best Regards, > > -- > 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.
url names
how to add url names to the following entry in urls.py. ( r'^all/synchro/download/file/', "get_all_data_download" ) -- 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.
It is possible to list data from a database view in Django?
Hi, I'm new to Django. I'm in the process of test the features of Django to move a site from PHP to Python/Django. I have a database view that is the result of many joints between tables, I only do SELECTs to this view, the data is inserted via a Script that will populate the various tables. I only need to show the data in this view, how Django handles the listings of data in views? I have to define the view in the model? Please give me a clue. Best Regards, -- 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 up homepage, and naming/organizing apps
On 19/07/2011 1:49pm, Alex Hall wrote: Hello all, I was on this list a few months ago, but was unable to get a django-friendly web host. I am now helping with a site on Bluehost, which does support django, and I am hoping to be given permission by the guy in charge to use django instead of php for our project. I have been going through the tutorial, adapting it to my project as necessary, and have a couple questions. 1. This must be glaringly obvious, but how do I use django to load my homepage (index.html in the public_html root)? I understand about views and url matching, but there is no views.py in the main directory and I am not sure if I am supposed to create one or not. In other words, how does django know where to find the page to load when a visitor simply goes to mysite.com, instead of mysite.com/something_to_match? Normally you would build a dynamic home page but here is a simple sequence ... 1. Write a hello world index.html which will be your "home" page 2. Put it in /templates where is the directory containing settings.py 3. In urls.py where your other patterns exist scroll to the end and add this ... # note the += which appends this pattern to the others. urlpatterns += patterns('', # empty string r'' matches any URL so put it last (r'', 'flatviews.flatpage'), ) 4. Create a new file flatviews.py in the directory like this ... from django.shortcuts import render_to_response def flatpage(request, pagename='index.html'): return render_to_response(pagename) Should do the trick. Your mission is now to build your home page from inherited templates and database content via the django template language. 2. The project I am working on has a few tables: media, articles, and authors. An article can have one author and one or more rows in the media table associated with it. I currently have an app called "tables", in which I plan to define the three tables in models.py (I am only working with authors as a test). All my views, urls, and so forth will be inside this tables app. Is this generally recommended, or should I have an app for each table? The layout principle as set down by James Bennet in Practical Django Projects is to keep it simple. In other words you would begin by keeping it all in a single app directory. If it starts to get complex you can refactor into separate directories eg all views in a views directory etc. In there you can have different files for different groups of views which might have some similarity such as all needing to import the same particular model or models. Models too can be split into different files in a separate models directory. Keep stuff together which belongs together. Finally, he says to try and segregate your own project into separate apps in their own directories with their own urls, models, views etc on the basis of some sort of standalone functionality. My own take on this is to not worry when you are a beginner because it will become obvious when things are getting messy and you suddenly realise all you have to do is unclutter directories into a nice and comfortable hierarchy. One example above is flatviews.py which I said to put in the directory. If you decided that was getting too cluttered you could make a views directory and move it into /views/flatviews.py and refactor urls.py so it called 'views.flatviews.flatpage' Good luck Mike The tutorial has two tables defined, but the urls are all /polls/[something], whereas my urls might be /authors/, /author/[id], /article/[id], and so on (not sharing /[app_name]/... like the tutorial does). I hope that made sense! -- 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 up homepage, and naming/organizing apps
On Tue, Jul 19, 2011 at 9:19 AM, Alex Hallwrote: > > 1. This must be glaringly obvious, but how do I use django to load my > homepage (index.html in the public_html root)? I understand about > views and url matching, but there is no views.py in the main directory > and I am not sure if I am supposed to create one or not. In other > words, how does django know where to find the page to load when a > visitor simply goes to mysite.com, instead of > mysite.com/something_to_match? > > Dont you have a urls.py in your project? Something like this will take you to the "/" of the site: url(r'^$','index' ,{}, name="index"), > 2. The project I am working on has a few tables: media, articles, and > authors. An article can have one author and one or more rows in the > media table associated with it. I currently have an app called > "tables", in which I plan to define the three tables in models.py (I > am only working with authors as a test). All my views, urls, and so > forth will be inside this tables app. Is this generally recommended, > or should I have an app for each table? The tutorial has two tables > defined, but the urls are all /polls/[something], whereas my urls > might be /authors/, /author/[id], /article/[id], and so on (not > sharing /[app_name]/... like the tutorial does). I hope that made > sense! > Since all the 3 tables relate to a 'single' functionality - this is fine. -V -- 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 up homepage, and naming/organizing apps
On Tuesday, 19 July 2011 04:49:00 UTC+1, Alex wrote: > > Hello all, > I was on this list a few months ago, but was unable to get a > django-friendly web host. I am now helping with a site on Bluehost, > which does support django, and I am hoping to be given permission by > the guy in charge to use django instead of php for our project. > > I have been going through the tutorial, adapting it to my project as > necessary, and have a couple questions. > > 1. This must be glaringly obvious, but how do I use django to load my > homepage (index.html in the public_html root)? I understand about > views and url matching, but there is no views.py in the main directory > and I am not sure if I am supposed to create one or not. In other > words, how does django know where to find the page to load when a > visitor simply goes to mysite.com, instead of > mysite.com/something_to_match? > > I don't know why you mention "index.html in the public_html root". Django pages are dynamic and are not served from the html_root. You could set up your webserver to look there for URLs matching / only, but are you sure you don't have *any* dynamic or database-based content in your home page? Not even a menu? Seems strange. Normally, you would just set up a url to match r'^$' and route to a view in the normal way. > 2. The project I am working on has a few tables: media, articles, and > authors. An article can have one author and one or more rows in the > media table associated with it. I currently have an app called > "tables", in which I plan to define the three tables in models.py (I > am only working with authors as a test). All my views, urls, and so > forth will be inside this tables app. Is this generally recommended, > or should I have an app for each table? The tutorial has two tables > defined, but the urls are all /polls/[something], whereas my urls > might be /authors/, /author/[id], /article/[id], and so on (not > sharing /[app_name]/... like the tutorial does). I hope that made > sense! > No, you have it right. These three models are clearly all related, so belong together in one app. -- DR. -- 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/-/nfqCPDHakM4J. 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 up homepage, and naming/organizing apps
Hello all, I was on this list a few months ago, but was unable to get a django-friendly web host. I am now helping with a site on Bluehost, which does support django, and I am hoping to be given permission by the guy in charge to use django instead of php for our project. I have been going through the tutorial, adapting it to my project as necessary, and have a couple questions. 1. This must be glaringly obvious, but how do I use django to load my homepage (index.html in the public_html root)? I understand about views and url matching, but there is no views.py in the main directory and I am not sure if I am supposed to create one or not. In other words, how does django know where to find the page to load when a visitor simply goes to mysite.com, instead of mysite.com/something_to_match? 2. The project I am working on has a few tables: media, articles, and authors. An article can have one author and one or more rows in the media table associated with it. I currently have an app called "tables", in which I plan to define the three tables in models.py (I am only working with authors as a test). All my views, urls, and so forth will be inside this tables app. Is this generally recommended, or should I have an app for each table? The tutorial has two tables defined, but the urls are all /polls/[something], whereas my urls might be /authors/, /author/[id], /article/[id], and so on (not sharing /[app_name]/... like the tutorial does). I hope that made sense! -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- 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: static urls
Hi, Depends on how you configured STATIC_URL in settings. If / is there in the STATIC_URL, then no need to add it. Add it with STATIC_URLS, that is the standard practice. regards, Anoop atm ___ Life is short, Live it hard. On 19 July 2011 11:31, NISA BALAKRISHNANwrote: > i am new to django > > @import "{{STATIC_URL}}/css/demo_page.css"; > > the slash after {{STATIC_URL}} is needed? what is the actual usage ? > > -- > 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.
static urls
i am new to django @import "{{STATIC_URL}}/css/demo_page.css"; the slash after {{STATIC_URL}} is needed? what is the actual usage ? -- 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.