Is the Django book written in ReST/Sphinx?
I'm just working on a book for my own project, and I was wondering: Is the Django book written in ReST/Sphinx? I am considering whether I should write my book with that. Thanks, Ram. -- 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: Is the Django book written in ReST/Sphinx?
On Mon, May 17, 2010 at 2:00 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > On Mon, May 17, 2010 at 7:06 AM, cool-RR wrote: > > I'm just working on a book for my own project, and I was wondering: Is > > the Django book written in ReST/Sphinx? I am considering whether I > > should write my book with that. > > This is slightly off topic for this list, but I would advise that this > is something you need to take up with your publisher. Ultimately, > whatever your personal preferences, your publisher will control the > formats that you can use to submit a final manuscript. > > As for the specific question; I can't speak specifically for the > Django Book, but I do know that Practical Django Projects was > originally drafted in ReST, but had to be converted to Word format for > final submission. Given that the Django Book published by the same > publisher, I'm going to guess the same rules applied. > > Yours, > Russ Magee %-) Thanks for your help! Ram. -- 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.
What is `sys.path` supposed to be?
Hello! There's something that's bothering me: When developing a Django application, what is `sys.path` supposed to contain? The directory which contains the project, or the directory of the project, or both? What led me to this question is a failure when using `urlresolvers.reverse`. It's giving me a `NoReverseMatch` error, and it seems that the reason is that there are two different versions of my view function; One with a `__module__` of `my_app.views` and one with a `__module__` of `my_project.my_app.views`. Because of Python weirdness, these two different versions of the same function are not considered identical to each other: http://bugs.python.org/issue9872 Please help... Ram. -- 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: What is `sys.path` supposed to be?
On Sep 17, 10:13 am, bruno desthuilliers wrote: > On 16 sep, 18:06, cool-RR wrote: > > > Hello! > > > There's something that's bothering me: > > > When developing a Django application, what is `sys.path` supposed to > > contain? The directory which contains the project, or the directory of > > the project, or both? > > sys.path always starts with the directory where the current script > lives - so when running './manage.py runserver', sys.path will always > starts with your project's directory. This is teh default Python > behaviour. Also and IIRC, django adds the project's parent directory > to sys.path too. > > > What led me to this question is a failure when using > > `urlresolvers.reverse`. It's giving me a `NoReverseMatch` error, and > > it seems that the reason is that there are two different versions of > > my view function; One with a `__module__` of `my_app.views` and one > > with a `__module__` of `my_project.my_app.views`. > > I bet you have a full import (=> 'myproject.my_app.views') somewhere > in your sources. > > As far as I'm concerned, I *never* use any reference to the project's > package in my imports - this gives much more flexibility (you can > rename your project's directory, move apps outside the project's > directory etc without having to update all your imports). The only > caveat is that, when deploying with mod_wsgi, you have to make sure > you add the project's directory itself to sys.path (which is no bige > deal). Bruno, look at this line in `django/core/management/__init__.py`: project_module = import_module(project_name) It's importing the project. Isn't this a problem? I mean, every object obtained from the imported project will be different from its counterpart which was imported through an app. So what's going on? Ram. -- 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.
A dark color scheme for the admin site
Hello, Does anyone have a ready-made template with a dark color scheme for the admin site? Ideally I'd want something where the text is light grey and the background is dark grey, but I'd settle for anything light-on-dark. -- 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.
Forcing HTTPS in admin
Does `admin` provide a way to force using it through https? I'd want it to simply redirect a user which doesn't use https to the same address, except with https instead of http. Is there something like this built into `admin`? Ram. -- 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.
Serving https with runserver
Why doesn't runserver automatically serve in https as well as http? It would have been useful. Ram. -- 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: Serving https with runserver
I'm not using Apache on my development machine and I don't want to use it. I enjoy the low headache factor of runserver. But it'll be nicer if it served through https as well. On Mar 1, 12:53 am, Andrej wrote: > because you need to load apache ssl gear. Set up your normal virtual > host and then use reverse proxy: > > ProxyPass /http://localhost:8000/ > ProxyPassReverse /http://localhost:8000/ > > On Feb 28, 5:09 pm, cool-RR wrote: > > > > > Why doesn't runserver automatically serve in https as well as http? It > > would have been useful. > > > Ram. -- 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: Serving https with runserver
Adnan, I'm really baffled by your response. No, my reasons for using SSL here is not because I'm afraid someone will sniff my data, We are talking here about `runserver`, which is the development server which is never used for production. The goal of `runserver` is to be able to easily test how your Django project behaves before you upload it to the real server. So the purpose of me wanting to use https on `runserver` are NOT because I think someone will hack into my local machine. It's because I want to test the behavior of the site. For example, I may have some complex redirection scheme, where some http pages on the site redirect you to https, and vice versa. So I would like to be able to test them out on the development machine before uploading to the server. I checked out Stunnel. I'd prefer to avoid it. It's another program I will have to install and configure, and then I'll have to install and configure an SSL library, and then these things will have to be connected with `runserver`, which may result in problems and headache. The whole motivation to use `runserver` is how easy and painless it is, so I'd prefer it include these things out of the box. Ram. On Mon, Mar 1, 2010 at 2:53 AM, Adnan Sadzak wrote: > If it's on your local machine there is no big sense to use ssl unles you > are paranoid. If someone can sniff local traffic, then ssl is useless. > Anyway, as Janusz said http://www.stunnel.org/ > > > On Mon, Mar 1, 2010 at 1:06 AM, Janusz Harkot wrote: > >> So you can use stunnel: http://www.stunnel.org/ >> >> J. >> >> -- 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: Forcing HTTPS in admin
I did the middleware to do this, but I figured that making the admin encrypted would be a common enough task that it should be a builtin option in the admin. So anyway, +1 for that. On Mar 1, 5:21 pm, Malcolm Box wrote: > You could, but doing it on the front-end webserver makes more sense. > > Malcolm > > > > On Mon, Mar 1, 2010 at 3:02 PM, ozgurv wrote: > > You can write a middleware that redirects users who visit admin > > related pages (starts with /admin maybe) to HTTPS. > > > On Mon, Mar 1, 2010 at 2:08 AM, Janusz Harkot > > wrote: > > > no, but you can do this very easy on the fronted-webserver (nginx, > > > apache, cherokee etc.) > > > > J. > > > > -- > > > 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 > groups.com> > > . > > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > > -- > > Özgür Vatansever > > > -- > > 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 > groups.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-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.
Making a "Common causes for translation problems"
Hello Django community, I have started compiling a list, "Common causes for translation problems". Where would be a good place to put this list so people who have a problem with their translations will be most likely to encounter it? Ram Rachum. -- 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: Making a "Common causes for translation problems"
Hey Russ, At this point I'll just do a brief list, so I think I'll do it on the wiki. I don't want to invest too much time into it, but I'll be happy if someone else will want to expand it and put in in the documentation. (I think it'll be really useful to people who use i18n.) Thanks, Ram. On Sat, Mar 20, 2010 at 8:17 AM, Russell Keith-Magee wrote: > On Fri, Mar 19, 2010 at 9:16 PM, cool-RR wrote: > > Hello Django community, > > > > I have started compiling a list, "Common causes for translation > > problems". Where would be a good place to put this list so people who > > have a problem with their translations will be most likely to > > encounter it? > > Depends on what exactly it is that you are writing. > > If you're just kicking around some ideas or trying to provide a page > you can easily reference when someone on django-users asks a > translation-related question, you could put your list up on Django's > wiki (code.djangoproject.com). This isn't formal documentation, but > many people put helpful snippets or discussions of common problems > there. > > However, if you're writing something that might be useful to a general > audience, feel free to suggest an addition to Django's own > documentation. We have some existing guidelines for translators in our > documentation, but if you think you can provide some additional > guidelines or suggestions that would help others translate their > Django projects, we'd love to see some draft text. Open a ticket on > the documentation component, and provide a patch that adds your text. > > 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-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. > > -- Sincerely, Ram Rachum -- 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.
Changing SECRET_KEY for a project that was already launched
Hi guys, I have a project online whose SECRET_KEY was compromised. I obviously want to change it. Would anything bad happen if I change it? Would some things not work? Is it safe to just change it? Anything I should do? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Djangocon videos
Hi guys, I want to watch videos of talks from the recent Djangocon. But, I don't want to weed through all of them manually looking for the best ones. Did anyone make a "best of" list? Is there a way to sort by popularity or rating or something? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/834b4f65-ce1f-40be-ada0-aac63f528d78%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Why is django-registration 0.8 not on PyPI?
Hey, Does anyone know what's up with django-registration 0.8 not being on PyPI? Ram. -- 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 do I change my user password on Django's bug tracker?
Hello, How do I change my user password on Django's bug tracker? Thanks, Ram. -- 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/-/Z1HJTz2KIkEJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Can the new `Prefetch` solve my problem?
Hi guys, I'm trying to solve a problem using the new `Prefetch` but I can't figure out how to use it. I have these models: class Desk(django.db.models.Model): pass class Chair(django.db.models.Model): desk = django.db.models.Foreignkey('Desk', related_name='chair',) nearby_desks = django.db.models.ManyToManyField( 'Desk', blank=True, ) I want to get a queryset for `Desk`, but it should also include a prefetched attribute `favorite_or_nearby_chairs`, whose value should be equal to: Chair.objects.filter( (django.db.models.Q(nearby_desks=desk) | django.db.models.Q(desk=desk)), some_other_lookup=whatever, ) Is this possible with `Prefetch`? I couldn't figure out how to use the arguments. Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46d9fdb7-c008-4496-acda-ac7cb30b4a89%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Can the new `Prefetch` solve my problem?
James, you misunderstood me. There isn't supposed to be a `favorite_or_nearby_chairs` attribute. That's the new attribute I want the prefetching to add to the `Desk` queryset that I need. Also, I don't understand why you'd tell me to add a ` .select_related('nearby_desks')` to my query. Are you talking about the query that starts with `Chair.objects`? I'm not looking to get a `Chair` queryset. I'm looking to get a `Desk` queryset, which has a prefetched attribute `favorite_or_nearby_chairs` which contains the `Chair` queryset I wrote down. Thanks, Ram. On Thursday, February 26, 2015 at 6:02:15 AM UTC+2, James Schneider wrote: > > Well, the Desk model you provided is blank, but I'll believe you that > there's a favorite_or_nearby_chairs attribute. ;-) > > Should be relatively simple. Just add a .select_related('nearby_desks') to > your existing query and that should pull in the associated Desk object in a > single query. You can also substitute in prefetch_related(), although > you'll still have two queries at that point. > > If you are trying to profile your site, I would recommend the > Django-debug-toolbar. That should tell you whether or not that query set is > the culprit. > > -James > On Feb 25, 2015 1:28 PM, "Ram Rachum" > > wrote: > >> Hi James, >> >> I've read the docs but I still couldn't figure it out. My queryset works >> great in production, I'm trying to optimize it because our pageloads are >> too slow. I know how to use querysets in Django pretty well, I just don't >> know how to use `Prefetch`. >> >> Can you give me the solution for the simplified example I gave? This >> might help me figure out what I'm not understanding. One thing that might >> be unclear with the example I gave, is that I meant I want to get a >> queryset for `Desk` where every desk has an attribute names >> `favorite_or_nearby_chairs` >> which contains the queryset of chairs that I desrcibed, prefetched. >> >> >> Thanks, >> Ram. >> >> On Wed, Feb 25, 2015 at 11:18 PM, James Schneider > > wrote: >> >>> I assume that you are talking about the select_related() and >>> prefetch_related() queryset methods? >>> >>> >>> https://docs.djangoproject.com/en/1.7/ref/models/querysets/#select-related >>> >>> https://docs.djangoproject.com/en/1.7/ref/models/querysets/#prefetch-related >>> >>> Both of those sections have excellent examples, and detail what the >>> differences are (primarily joins vs. separate queries, respectively). >>> >>> For better help, you'll need to go into more detail about the queries >>> you are trying to make, what you've tried (with code examples if possible), >>> and the results/errors you are seeing. >>> >>> In general, I would try to get an initial queryset working and gathering >>> the correct results first before looking at optimizations such as >>> select_related(). Any sort of pre-fetching will only confuse the situation >>> if the base queryset is incorrect. >>> >>> -James >>> >>> On Wed, Feb 25, 2015 at 12:05 PM, cool-RR >> > wrote: >>> >>>> Hi guys, >>>> >>>> I'm trying to solve a problem using the new `Prefetch` but I can't >>>> figure out how to use it. >>>> >>>> I have these models: >>>> >>>> class Desk(django.db.models.Model): >>>> pass >>>> >>>> class Chair(django.db.models.Model): >>>> desk = django.db.models.Foreignkey('Desk', >>>> related_name='chair',) >>>> nearby_desks = django.db.models.ManyToManyField( >>>> 'Desk', >>>> blank=True, >>>> ) >>>> >>>> I want to get a queryset for `Desk`, but it should also include a >>>> prefetched attribute `favorite_or_nearby_chairs`, whose value should be >>>> equal to: >>>> >>>> Chair.objects.filter( >>>> (django.db.models.Q(nearby_desks=desk) | >>>> django.db.models.Q(desk=desk)), >>>> some_other_lookup=whatever, >>>> ) >>>> >>>> Is this possible with `Prefetch`? I couldn't figure out how to use the >>>> arguments. >>>> >>>> >>>> Thanks, >>>> Ram. >>>> >&
Prefetching a single item
Hi, Say that I have a model Train and it has a ManyToMany to model Seat. I'm looking at a queryset of Train and I want to do a prefetch_related on it, but I don't want to get all the Seat objects; I want only the first Seat object for each Train object. Is this possible with prefetch_related and/or Prefetch? How? To clarify: My goal here is to save on querysets while still being able to retrieve the first Seat object in each `train.seats`. Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1d6fc84a-2042-40b5-98be-40bd971e706c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
List of default Django tags that are "mid-block" like else
Hi guys, Can someone please give me a list of default Django template tags that have "mid-block" behavior like `else`? I mean tags where instead of simply having a start tag and an end tag, you have an optional tag in the middle that divides the whole thing to blocks. I can think of: if ifchanged ifequal else elif Anything else? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e69642f-f856-48db-8818-37697c85efd9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Controlling admin ManyToManyField widget with keyboard
Hi, How do I control the admin ManyToManyField widget with the keyboard? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6debf220-f450-4883-9021-502318880e0d%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Is there a good reason why Django querysets can't be intersected?
Hi everyone, I understand that there's no way to get the intersection of two querysets in Django. Whenever I need to get the intersection of two querysets, I need to refactor my code to get pure Qs for those querysets and intersect those. This can be annoying sometimes. My question: Is there a good reason why Django querysets can't be intersected? Do you think it should be implemented? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b6b3a367-e5c0-4440-98b6-5a9d78a78db3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Creating test databases in parallel
Hi guys, I'm trying to optimize our Django testing workflow. We have 7 different databases, and Django spends a lot of time on these lines: Creating test database for alias 'main_database'... Creating test database for alias 'foo_database'... Creating test database for alias 'bar_database'... Creating test database for alias 'baz_database'... This is especially annoying when you're running just one test, but have to wait 1:30 minutes just for these test databases. *Is there any way to speed this up? *Either by parallelizing it or in any other way. A few months ago I tried some naive code that parallelizes these actions, but it failed. (Unfortunately I don't have the error message saved.) Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com.