Hello there,
until now I (and many others) used to define default custom settings
in /settings.py in this way:
from django.conf import settings
default = lambda k, v: getattr(settings, k, v)
PREFIX_KEY = default('PREFIX_KEY', 'value')
...
and in other modules I used django-settings along my own
Common guys, this thread isn't about me and CGI :) I really don't care
what it is and know, when you've just told me what it is I don't care
even more :)
If you know what's CGI, feel free to answer the original question:
"Could Django be deployed using CGI?"
Cheers,
Tom :)
Dne Wed, 10 Oct 2012
Well, in this case, I don't see problem in erroritself (that happens).
I see problem in missing trackback (that's not usual). My assuption was
that "something" suppress it (don't know if it's possible, but I
assume it is).
Cheers,
Tom
Dne Fri, 12 Oct 2012 17:00:01 +0100
Tom Evans napsal(a):
>
Hi Michał,
is "schema" the same as thing as "tablespace"? If so, you should define them
using
db_tablespace meta keyword.
https://docs.djangoproject.com/en/1.4/topics/db/tablespaces/
DATABASES creates new database connection and it's really not
possible to make relations between databases.
Cheer
Hello,
have you set proper aliases in apache site config?
Alias /robots.txt /path/to/mysite.com/static/robots.txt
Alias /favicon.ico /path/to/mysite.com/static/favicon.ico
AliasMatch ^/([^/]*\.css) /path/to/mysite.com/static/styles/$1
Alias /media/ /path/to/mysite.com/media/
Alias /static/ /path
another problem as the following
> picture. As the picture, my models don't have "Add" and "Change" button,
> which they have when I run this site on development server or when I just set
> DEBUG in settings.py to True.
>
>
>
>
>
> Dae Ja
Hi Nikhil,
you can't do that with django template system without additional "raw" tag.
Here's a relevant article:
http://www.holovaty.com/writing/django-two-phased-rendering/
Cheers,
Tom
Dne Fri, 19 Oct 2012 15:51:39 +0530
Nikhil Verma napsal(a):
> Hello people
>
> I need some suggestion in
Hello,
there's a little hint at the end of exception:
> No module named unipath
Seems like you import module unipath in your settings.py, which is not
on your sys.path.
I never set PYTHONPATH for development and everything works fine.
Python adds current directory to sys.path, so when you run ./
Hello,
you need to make 'year' argument optional:
def student_reports(request, year=None):
year = year or datetime.date.today().year
...
Another option could be passing extra option to you view function:
https://docs.djangoproject.com/en/1.4/topics/http/urls/#passing-extra-options-to-view
Hi Michał,
actually, you *do have* such a privilege. Simply clone development
version of django, fix the file with bug, test it, and post patch to
ticket you've mentioned.
If you include test which check, that your patch really fix the bug,
core developers will pull in into repository soon.
It's
Hi Kristofer,
I usualy put methods like this one into Model, although Manager is also
possible. Definitely not View or sth else.
Why I like Model more than Manager is this difference (suppose your
method is called make_payment):
Account.make_payment # via Model
Account.objects.make_payme
Hi there,
the key idea is: *Let's have URLs defined at one and only one place.*
So, when you have urls.py like this:
urlpatterns = patterns('',
'^blog/(?P\w+)', BlogDetail.as_view(), name='blog-detail',
'^articles/(?P\w+)', ArticleDetail.as_view(),
Hello John,
welcome in Django, hope you'll find it useful as I did.
Extend Django admin is a little bit tricky, but not impossible.
You can add your own views to admin simply by extending your ModelAdmin
subclass.
See
https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.M
Hi Nenad,
you can wrap your meta-refresh line in another block and then delete
it's content in templates which shouldn't be refreshed.
# base_site.html
{% block extrahead %}
{% block extrahead-refresh %}
{% endblock %}
{% endblock %}
# change_form.html -- deletes content of block
ew, you
have to sublass ModelAdmin or whole AdminSite. It's overkill when you
need tune some details like this.
Cheers,
Tom
Dne Mon, 11 Mar 2013 11:51:47 +
Tom Evans napsal(a):
> On Sat, Mar 9, 2013 at 10:28 AM, Tomas Ehrlich
> wrote:
> > Hi Nenad,
> > you can
Hi Alex,
congratulation to alpha release of your app.
I was about to suggest you django-bootstrap-admin, django-admin-tools
and django-fluent-dashboard, but since you already know Admin tools,
could you please provide more details about your app? I took a quick
look at demo page and read Readme fi
> You can't do it perfectly the first time. The only way to do it well
> is experience. The only way to get experience is to make mistakes.
I disagree. When you make mistake, you know what's wrong, but you still
don't know, what's right. You need to learn, how to make things right.
To Benjamin:
Hi John
{% csrf_token %} must be definitely inside the tag. It renders .
Please try it and tell if it works.
Cheers,
Tom
Dne Thu, 4 Apr 2013 14:38:58 -0700 (PDT)
John napsal(a):
> This is Django 1.5
> Python 2.7.3
> MYSQL Database
>
> Here is the model that I am using:
>
> class Supporti
Hi there,
this question isn't bound to Django Web Framework as the major
limitation are cookies:
I have single instance Django site running on multiple domains. Each
domain simply filters specific categories. There's an eshop and I need
to share sessions among all domains so user can log in on one
one, if you implement that please
> share how
>
>
> On Tue, Jun 11, 2013 at 10:04 AM, Tomas Ehrlich
> wrote:
>
> > Hi there,
> > this question isn't bound to Django Web Framework as the major
> > limitation are cookies:
> >
> > I have single
jango-users-and-sessions-across-projects/
> I hope this helps.
>
> Best regards,
> Marcin
>
> On 14:22 Tue 11 Jun , Tomas Ehrlich wrote:
> > Hi Avraham,
> > I know that cookies can be shared among subdomains, but my customer wants to
> > have separate
Hi Benjamin,
you can create explicit OneToOne field with parent_link=True
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.OneToOneField.parent_link
Then you can set different related_name for each model.
Cheers,
Tom
Dne Wed, 12 Jun 2013 01:10:40 -0700 (PDT)
Benjamin
Hi Tom,
that's interesting approach. I'm going to use it and publish code later.
Thank you!
Cheers,
Tom
PS: The key is the name of problem:) SSO
https://github.com/ojii/django-simple-sso
https://github.com/bltravis/django-token-sso
Dne Wed, 12 Jun 2013 10:30:43 +0100
Tom Evans napsal(a):
Hi there,
please try:
TEMPLATE_DIRS = (
"C:/xampp/htdocs/mytemplates/"
)
After all, it's TEMPLATE_DIRS not TEMPLATE_FILES. It should contain
directories with templates.
Cheers,
Tom
Dne Thu, 27 Jun 2013 09:46:40 -0700 (PDT)
krazyXplorer <1.kc.d...@gmail.com> napsal(a):
> I am new to Djan
Hi Roman,
you can use model validation
https://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects
It works similar to form validation. After, when you create ModelForm,
it will take validation rules from model.
All these validations should be called outside save()
Cheers,
Hi there,
it's probably silly bug, but I can't figure it out:
I have one test:
###
# app/tests_functional/test_app.py
from django.core.urlresolvers import reverse
from django.test import TestCase
class TestApp(TestCase):
urls = 'app.tests_functional.urls'
def test_app(self):
pri
Hi there,
you're certaily missing {% csfr_token %} in your form.
If it doesn't solve the problem, you need to provide more info and be more
specific about your "trouble".
Dne Sat, 6 Jul 2013 17:44:04 +0530
Kakar Arunachal Service napsal(a):
> Hi,
> I am having trouble with redirecting the logi
Hi there,
first, there's a difference between MEDIA files and STATIC files (since
1.3, I think). Media files are files uploaded by users, while static
files are usually persistent files on the server from the beginning,
eg. stylesheets, images, javascripts, robots.txt, etc.
It's good to keep these
Hi there,
I'm looking for django (or python) based webmail, similar to RoundCube
and SquirrelMail.
I tried djangopackages.com and google search, but it doesn't seem to be
an alive project out there. How you ever wondered why? :) Seems to me
like useful app.
Thanks in advance
Cheers,
Tom
--
This isn't possible. The problem is with cookies: You have to bind them
to certain domain ('example.com') or set of subdomains ('.example.com').
About a month ago I've created app to bypass this limitation:
- There is one "master" domain, where new session keys are created.
- When user access any
Ah, sorry, I understand now.
You can set up middleware, which modifies SESSION_COOKIE_DOMAIN based
on request.get_host() and put it before session middleware. I did
similar thing to set SITE_ID.
Only think you have to take care of is thread safety. You need to
override settings.SESSION_COOKIE_DOM
Hi,
I apologize for possible off-topic, but since Jacob already answered
your question, please allow me to add another hint:
Book.objects.filter(published=False).update(published=True)
would do the same in single query, updating "published" field only (even in
<1.5).
Cheers,
Tom
Dne Wed, 1
Hi,
disable Template panel in debug_toolbar and try again.
Debug toolbar hits database when evaluating template context.
Cheers,
Tom
Dne Sat, 31 Aug 2013 12:09:00 +0100
Marcin Szamotulski napsal(a):
> Hello,
>
> I am using django-1.6.b2 on a localserver (./manage.py runserver) and
> for e
I wonder if licence agreement applies for this case, since domain was
clearly bought before Django project finished it's trademark policy.
Dne Fri, 20 Sep 2013 08:23:27 -0400
Karen Tracey napsal(a):
> Please note any use of djangojobs.com domain would need to conform to the
> Django trademark l
I use it too.
Maybe it would be nice to document it somewhere.
Cheers,
Tom
Dne Tue, 24 Sep 2013 10:59:27 -0700 (PDT)
Warren Smith napsal(a):
> On occasion, I've used the following technique in my django templates:
>
> # parent.html
>
> {% block someblock %}
> …stuff…
> {% if cool_opti
Hi Harjot,
try https://github.com/Kozea/wdb if you want debugger like pdb
or simple https://github.com/django-debug-toolbar/django-debug-toolbar
which provides lots of useful informations.
Unfortunately, I don't use pdb nor wdb, so I can't help you with any of them.
Cheers,
Tom
Dne Tue, 5 Nov
Hi there,
I don't know if it's relevant, I've never used it, but the name sounds
promising:
StreamingHttpResponse
https://docs.djangoproject.com/en/dev/ref/request-response/#streaminghttpresponse-objects
Cheers,
Tom
Dne Fri, 15 Nov 2013 12:53:23 -0500
Javier Guerra Giraldez napsal(a):
> On
Use __gte lookup:
latest_articles_list = Article.objects.filter(pub_date__gte=thirty_days_ago)
and take a look at other lookups:
https://docs.djangoproject.com/en/1.6/ref/models/querysets/#field-lookups
Cheers,
Tom
Dne Sun, 20 Jul 2014 20:50:53 -0700 (PDT)
Conner DiPaolo napsal(a):
> I've b
Hi there,
as pointed in documentation [1], automatic loading of initial data from
initial_data.[xml/yaml/json] is deprecated since 1.7 in favor of data
migrations.
However, there are several drawbacks and differencies:
1. Data migration is executed only once (unless migrations are
rewinded
Hi there,
when I deploy my django projects I always run several commands after
pulling latest code from repository. I've started using setup.py few
weeks ago which adds manage.py script into $VENV/bin.
Basicaly, I always do:
source $VENV/bin/activate
export DJANGO_SETTINGS_MODULE=...
git pull
py
Hi,
use ugettext_lazy for translation of urls, models and other stuff which
is loaded before language is determined (it's usually done in
Middleware or later in view, otherwise all strings will be translated
into default language).
You can also write:
url(_(r'^about$'), views.about, name='about
Hi there,
since all have already mentioned Fabric, take a look at Ansible which
is a bit more sophisticated tool, but can be used efficiently even for
small setups.
Depends on your requirements, you can create simple "deployment"
playbook, which just takes your code, push it to the server, update
42 matches
Mail list logo