runserver cache my template files

2012-06-22 Thread bruno desthuilliers
I assume you did check your browser cache ? 

-- 
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/-/vcMDF4DurtYJ.
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: runserver cache my template files

2012-06-22 Thread Tomás Garzón Hervás
Yes, and I reload the browser with empty cache.
thanks

On Friday, June 22, 2012 9:02:23 AM UTC+2, bruno desthuilliers wrote:
>
> I assume you did check your browser cache ? 

-- 
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/-/GE0EUGFeQKwJ.
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 learning

2012-06-22 Thread Tomás Garzón Hervás
Hi, you have to indicate where is the settings file to django. You can use 
the environment variable DJANGO_SETTINGS_MODULE.
 More info:
https://docs.djangoproject.com/en/dev/topics/settings/#using-settings-without-setting-django-settings-module



On Friday, June 22, 2012 8:15:53 AM UTC+2, lovetoprogram wrote:
>
> I tried to do this according the tutorial. 
> >>> from django import template 
> >>> t = template.Template('My name is {{ name }}.') 
> >>> c = template.Context({'name': 'Adrian'}) 
> >>> print t.render(c) 
> My name is Adrian. 
> >>> c = template.Context({'name': 'Fred'}) 
> >>> print t.render(c) 
> My name is Fred. 
>
> But I got this error 
> >>> t = template.Template('My name is {{ name }}.') 
>
> Traceback (most recent call last): 
>   File "", line 1, in  
> t = template.Template('My name is {{ name }}.') 
>   File "C:\Python27\lib\site-packages\django\template\base.py", line 
> 123, in __init__ 
> if settings.TEMPLATE_DEBUG and origin is None: 
>   File "C:\Python27\lib\site-packages\django\utils\functional.py", 
> line 184, in inner 
> self._setup() 
>   File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 
> 40, in _setup 
> raise ImportError("Settings cannot be imported, because 
> environment variable %s is undefined." % ENVIRONMENT_VARIABLE) 
> ImportError: Settings cannot be imported, because environment variable 
> DJANGO_SETTINGS_MODULE is undefined. 
>
> Any help 
>
> Cheers

-- 
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/-/iH-Co3Tx9bYJ.
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: Monitoring memory usage of an external component

2012-06-22 Thread Eugene Gavrish
> *Does anyone here use a tool to monitor memory usage by individual
> processes (or groups thereof), and run commands when certain levels are met?
> * I'd like to kill and restart my java service (through supervisor) when it
> gets above a certain size.

simple bash-script with  ps aux | grep java lists all your java-
processes. You need VSZ column

So you can write a simple cron-based solution

-- 
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: Any clue why Facebook iframe would be blank?

2012-06-22 Thread Gabriel - Iulian Dumbrava
Hi,
I think something similar happen to me when I set the width of the iframe 
to be too narrow. I'm not very sure, but maybe you cand check it out.

Gabriel

marți, 19 iunie 2012, 23:03:36 UTC+3, Kurtis a scris:
>
> *Bump*
>
> I've been trying to diagnose this problem. I have no idea what's going on, 
> though.
>
> 1. I tried just serving a simple .html page on Nginx to see if that's 
> where the problem was. It didn't serve properly (through an error) but it 
> did actually display the error. The problem there was, you can't POST to 
> static pages in NGINX. No big deal, I'm not trying to load a static page 
> anyways.
>
> 2. I looked in my log files. It turns out, my application is timing out. 
> It doesn't make any sense as it doesn't timeout anywhere else.
>
> 3. Here's some logs that show something peculiar going on. I'm not sure 
> how to debug the issue. From what I am reading though -- here's what I 
> picture is going on.
>
> Nginx properly receives request. Nginx pushes request to uWSGI application 
> (django). Django successfully gets the request. Django tries to respond but 
> this must be where it breaks.
>
> I'm not sure what the issue is -- but it has something to do with being 
> inside a facebook iframe. (I have yet to check remote iframes in general, 
> I'll do that next)
>
> uWSGI Logs:
> [pid: 11059|app: 0|req: 3/4] 24.210.144.32 () {52 vars in 1170 bytes} [Tue 
> Jun 19 14:24:03 2012] POST /facebook/ => generated 0 bytes in 444 msecs 
> (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
> [pid: 11345|app: 0|req: 1/1] 24.210.144.32 () {52 vars in 1170 bytes} [Tue 
> Jun 19 14:24:31 2012] POST /facebook/ => generated 2970 bytes in 333 msecs 
> (HTTP/1.1 200) 4 headers in 128 bytes (1 switches on core 0)
> [pid: 11353|app: 0|req: 3/31] 24.210.144.32 () {52 vars in 1172 bytes} 
> [Tue Jun 19 14:31:04 2012] POST /facebook/ => generated 2970 bytes in 3 
> msecs (HTTP/1.1 200) 4 headers in 128 bytes (1 switches on core 0)
> [pid: 11954|app: 0|req: 1/14] 24.210.144.32 () {52 vars in 1216 bytes} 
> [Tue Jun 19 14:35:04 2012] POST /facebook/ => generated 2970 bytes in 343 
> msecs (HTTP/1.1 200) 4 headers in 128 bytes (1 switches on core 0)
> [pid: 11950|app: 0|req: 2/31] 24.210.144.32 () {52 vars in 1211 bytes} 
> [Tue Jun 19 14:48:57 2012] POST /facebook/ => generated 2970 bytes in 3 
> msecs (HTTP/1.1 200) 4 headers in 128 bytes (1 switches on core 0)
> [pid: 11962|app: 0|req: 4/57] 24.210.144.32 () {52 vars in 1216 bytes} 
> [Tue Jun 19 14:53:43 2012] POST /facebook/ => generated 2970 bytes in 2 
> msecs (HTTP/1.1 200) 4 headers in 128 bytes (1 switches on core 0)
>
> Nginx Error Logs:
> 2012/06/19 20:02:30 [error] 11164#0: *29617 readv() failed (104: 
> Connection reset by peer) while reading upstream, client: 24.210.144.32, 
> server: fireflie.com, request: "POST /facebook/ HTTP/1.1", upstream: 
> "uwsgi://", host: "www.fireflie.com", 
> referrer: "http://apps.facebook.com/253156011452899/";
>
> Nginx Access Log:
> 24.210.144.32 - - [19/Jun/2012:20:02:30 +] "POST /facebook/ HTTP/1.1" 
> 200 31 "http://apps.facebook.com/253156011452899/"; "Mozilla/5.0 (X11; 
> Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/12.04 
> Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19"
> 24.210.144.32 - - [19/Jun/2012:20:03:29 +] "-" 408 0 "-" "-"
> 24.210.144.32 - - [19/Jun/2012:20:03:29 +] "-" 408 0 "-" "-"
>
> *Does anyone have an idea on how to further debug this issue? Thanks!*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Jc22A2odYLMJ.
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: Time zone (Django 1.4) questions

2012-06-22 Thread Aymeric Augustin
Le jeudi 21 juin 2012 13:36:53 UTC+2, Aymeric Augustin a écrit :
>
> I haven't written that script and I don't know anyone else who has. No 
> promises, but since you need it, I may find the motivation to write it. 
>

Here you go: https://gist.github.com/2971450

The script is designed to handle advanced cases (inherited models, proxy 
models) but I haven't tested it. I've mentioned all the failure modes I 
could imagine in the disclaimer.

Let me know if it works for you!

Best regards,

-- 
Aymeric.

-- 
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/-/NgCN-MDc_nEJ.
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: Time zone support enabled in Django 1.4, yet "Django does not support timezone-aware times"

2012-06-22 Thread Aymeric Augustin
Le mardi 22 mai 2012 02:57:05 UTC+2, Arthur a écrit :
>
> I recently upgraded one of my machines to Django 1.4 to patch a bug 
> related to the use of PostGIS 9.1. I read the documentation on the new 
> support for time zones and added USE_TZ=True to my settings.py file. 
> Nonetheless, when I attempt to load data into my PostGIS database in one of 
> the following ways, I receive a ValueError: Django does not support 
> timezone-aware times. The full traceback is posted at the end. 
>

Hi Arthur,

The error message is about "timezone-aware times", not "timezone-aware 
datetimes". Your code must be creating a timezone-aware time object 
somewhere. This is quite a pathological type and it isn't supported by 
Django.

This limitation is briefly mentioned at the bottom of this 
section: 
https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#naive-and-aware-datetime-objects

Sorry for the late answer,

-- 
Aymeric.

-- 
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/-/0bzgv4H2WsUJ.
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.contrib.humanize naturaday not working with USE_TZ = True

2012-06-22 Thread Aymeric Augustin
Le dimanche 13 mai 2012 04:33:33 UTC+2, James Zheng a écrit :
>
> has anyone else run into the problem below?


Hi James,

Since you're talking about USE_TZ, I suppose you're using Django 1.4. But 
the code you're quoting no longer exists in that version:
https://github.com/django/django/commit/9b1cb755a28f020e27d4268c214b25315d4de42e#diff-3
 

That said, this appears to be a bug in Django. I've created a ticket:
https://code.djangoproject.com/ticket/18504

Best regards,

-- 
Aymeric.

-- 
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/-/gNvXW6g6otEJ.
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.



custom db field as filter in admin

2012-06-22 Thread Bram de Jong
Hello all,


I have a custom DB field: a version string like "1.0.5rc3" which is
actually stored as an int in the db.
After fidling around a bit I managed to make the field so that
everything you would think should work works. It looks like a version
string everywhere, I can input it as a version string everywhere.

However, when I turn this field into a filter in the admin, instead of
seeing the filter-versions as my string (i.e. "1.0.5rc3") I see it as
the underlying database type (i.e.1301)

I implemented __unicode__ and __str__ on my object, but no luck either!


 - bram

-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
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: PicklingError: Can't pickle : it's not the same object as pytz._UTC

2012-06-22 Thread Florian Apolloner
Hi,

I've never ran into this and the only way I can reproduce it is: 
http://bpaste.net/show/29LVTwRDX5DIgUSDE6D9/ -- So my question to you is: 
What exactly are you doing, how are you deploying, do you have code 
reloading active somewhere?

Cheers,
Florian

-- 
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/-/ICvRqXParfgJ.
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: custom db field as filter in admin

2012-06-22 Thread Melvyn Sopacua
On 22-6-2012 12:09, Bram de Jong wrote:

> However, when I turn this field into a filter in the admin, instead of
> seeing the filter-versions as my string (i.e. "1.0.5rc3") I see it as
> the underlying database type (i.e.1301)

I suspected there is another code path that doesn't call to_python
properly, but let's rule out it's not the same as my issue:
Is this field a foreign key for the model that's being displayed?
-- 
Melvyn Sopacua


-- 
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: custom db field as filter in admin

2012-06-22 Thread Bram de Jong
On Fri, Jun 22, 2012 at 12:27 PM, Melvyn Sopacua  wrote:
> On 22-6-2012 12:09, Bram de Jong wrote:
>
>> However, when I turn this field into a filter in the admin, instead of
>> seeing the filter-versions as my string (i.e. "1.0.5rc3") I see it as
>> the underlying database type (i.e.1301)
>
> I suspected there is another code path that doesn't call to_python
> properly, but let's rule out it's not the same as my issue:
> Is this field a foreign key for the model that's being displayed?

It isn't.

Where should I be digging to figure out the code path being called?

Additionally clicking the filter will make things crash because I'm
getting a string which is "1301" if I do.

Just to rule out simple stupidity on my part, here's the model field
and form field I'm using.

http://dpaste.com/762328/

 - Bram

-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
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: Time zone (Django 1.4) questions

2012-06-22 Thread Klaas van Schelven
Hi Aymeric,

Thanks for the answers!

I've decided to postpone the migration on one of our bigger projects
to USE_TZ = True until after I have some experience with proper time
zone handling in a greenfield project. This won't last forever,
though, and once I get to it I'll report back with any globally-useful
results.

I imagine some of the answers to my questions will be worked into the
docs at some point. If I can help out at that point in time I
certainly will.

ciao,
Klaas

On Jun 22, 10:57 am, Aymeric Augustin  wrote:
> Le jeudi 21 juin 2012 13:36:53 UTC+2, Aymeric Augustin a écrit :
>
>
>
> > I haven't written that script and I don't know anyone else who has. No
> > promises, but since you need it, I may find the motivation to write it.
>
> Here you go:https://gist.github.com/2971450
>
> The script is designed to handle advanced cases (inherited models, proxy
> models) but I haven't tested it. I've mentioned all the failure modes I
> could imagine in the disclaimer.
>
> Let me know if it works for you!
>
> Best regards,
>
> --
> Aymeric.

-- 
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: custom db field as filter in admin

2012-06-22 Thread Melvyn Sopacua
On 22-6-2012 12:58, Bram de Jong wrote:
> On Fri, Jun 22, 2012 at 12:27 PM, Melvyn Sopacua  
> wrote:
>> On 22-6-2012 12:09, Bram de Jong wrote:
>>
>>> However, when I turn this field into a filter in the admin, instead of
>>> seeing the filter-versions as my string (i.e. "1.0.5rc3") I see it as
>>> the underlying database type (i.e.1301)
>>
>> I suspected there is another code path that doesn't call to_python
>> properly, but let's rule out it's not the same as my issue:
>> Is this field a foreign key for the model that's being displayed?
> 
> It isn't.
> 
> Where should I be digging to figure out the code path being called?
> 
> Additionally clicking the filter will make things crash because I'm
> getting a string which is "1301" if I do.
> 
> Just to rule out simple stupidity on my part, here's the model field
> and form field I'm using.

You should not be getting integer instances in get_prep_lookup(). That's
your initial debugging point. I have a similar field (integer rep in
database and string rep in python) and I'll check if I can reproduce
your case, once I get back to that machine.

To get this bug[1] traced down, I created a logger in settings.py and
inserted logging statements and assert(1==2) in the code paths. But
there are some __magic__ methods involved that don't backtrace well, so
that's where logging comes in. If it's the same root cause as my bug,
implement value_from_object on your field and call to_python on the
value argument.

[1] https://code.djangoproject.com/ticket/18501
-- 
Melvyn Sopacua


-- 
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.



direct_to_template (with same name template) in a multi-app project

2012-06-22 Thread Joris A
Hello all,

I am developping a second app in the same project and want to use a
simple.direct_to_template view.

Both of my app require a login from user, thus I have in both app a
login page.
With a lot of creativity I named both of my login pages and index
pages ; login and index, with the corresponding templates login.html
and index.html.

I have a main urls.py file which include the urls of the two other
apps like this :
urlpatterns += patterns('',
url(r'^app1/', include('app1.urls')),
url(r'^app2/', include('app2.urls')),
)

In both app specific urls.py I have the following (simplified) :
urlpatterns = patterns('app1.views',
   (r'^$', 'index')
   )
urlpatterns += patterns('',
   (r'^login', 'django.views.generic.simple.direct_to_template',
{'template': 'login.html'}),
)

My problem is that the first app mentioned in settings "installed
apps" seem to have precedence in the template loading. It's like the
app tree is not taken into account in {'template': 'login.html'}. Thus
because they have the same name, I am always using the template of the
first app declared in installed apps.

If I rename the template index_app1.html and index_app2.html it works
as expected. So this is an option but...

Is there a way to tell which template to use?

Thanks in advance for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Import error

2012-06-22 Thread Emily N
Hi django users,
I seem to have gotten a problem.

I created a helper class in my project and I have failed to import
the methods in it. Please help...

This is the error I get...

ImportError at /admin/ 

cannot import name random_password

 Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django 
Version: 1.3.1  Exception Type: ImportError  Exception Value: 

cannot import name random_password

 Exception Location: 
/home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py 
in , line 1  Python Executable: /usr/bin/python  Python Version: 
2.7.2  Python Path: 

['/home/emily/Documents/AskJarvis/Etutor',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages/gst-0.10',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
 '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
 '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
 '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']


-- 
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/-/C1nnWqPBZkwJ.
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: Import error

2012-06-22 Thread Marcin Tustin
Please take a look at: Short, Self Contained, Correct Example

There's also some good advice at: What have you tried? - Matt
Gemmell

On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:

> Hi django users,
> I seem to have gotten a problem.
>
> I created a helper class in my project and I have failed to import
> the methods in it. Please help...
>
> This is the error I get...
>
> ImportError at /admin/
>
> cannot import name random_password
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>
> cannot import name random_password
>
>  Exception Location: 
> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
> in , line 1  Python Executable: /usr/bin/python  Python Version:
> 2.7.2  Python Path:
>
> ['/home/emily/Documents/AskJarvis/Etutor',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/usr/lib/python2.7/lib-old',
>  '/usr/lib/python2.7/lib-dynload',
>  '/usr/local/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages/PIL',
>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>  '/usr/lib/pymodules/python2.7',
>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>
>
>  --
> 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/-/C1nnWqPBZkwJ.
> 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.
>



-- 
Marcin Tustin
Tel: 07773 787 105

-- 
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: Import error

2012-06-22 Thread Emily
Dear Marcin,

I do not understand.
I think I have done everything right and I am trying to find
the source of the error where if there is someone who has
experienced it they might be knowing where it is coming from..

Emily

On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin wrote:

> Please take a look at: Short, Self Contained, Correct 
> Example
>
> There's also some good advice at: What have you tried? - Matt 
> Gemmell
>
>
> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>
>> Hi django users,
>> I seem to have gotten a problem.
>>
>> I created a helper class in my project and I have failed to import
>> the methods in it. Please help...
>>
>> This is the error I get...
>>
>> ImportError at /admin/
>>
>> cannot import name random_password
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
>> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>>
>> cannot import name random_password
>>
>>  Exception Location: 
>> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
>> in , line 1  Python Executable: /usr/bin/python  Python Version:
>> 2.7.2  Python Path:
>>
>> ['/home/emily/Documents/AskJarvis/Etutor',
>>  '/usr/lib/python2.7',
>>  '/usr/lib/python2.7/plat-linux2',
>>  '/usr/lib/python2.7/lib-tk',
>>  '/usr/lib/python2.7/lib-old',
>>  '/usr/lib/python2.7/lib-dynload',
>>  '/usr/local/lib/python2.7/dist-packages',
>>  '/usr/lib/python2.7/dist-packages',
>>  '/usr/lib/python2.7/dist-packages/PIL',
>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>  '/usr/lib/pymodules/python2.7',
>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>>
>>
>>  --
>> 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/-/C1nnWqPBZkwJ.
>> 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.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> 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: Import error

2012-06-22 Thread Marcin Tustin
Dear Emily,

Do you expect us to already have a copy of your code? If not, we need to
have a short, self-contained, and correct example demonstrating your issue.

Marcin

On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:

> Dear Marcin,
>
> I do not understand.
> I think I have done everything right and I am trying to find
> the source of the error where if there is someone who has
> experienced it they might be knowing where it is coming from..
>
> Emily
>
>
> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin wrote:
>
>> Please take a look at: Short, Self Contained, Correct 
>> Example
>>
>> There's also some good advice at: What have you tried? - Matt 
>> Gemmell
>>
>>
>> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>>
>>> Hi django users,
>>> I seem to have gotten a problem.
>>>
>>> I created a helper class in my project and I have failed to import
>>> the methods in it. Please help...
>>>
>>> This is the error I get...
>>>
>>> ImportError at /admin/
>>>
>>> cannot import name random_password
>>>
>>>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
>>> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>>>
>>> cannot import name random_password
>>>
>>>  Exception Location: 
>>> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
>>> in , line 1  Python Executable: /usr/bin/python  Python Version:
>>> 2.7.2  Python Path:
>>>
>>> ['/home/emily/Documents/AskJarvis/Etutor',
>>>  '/usr/lib/python2.7',
>>>  '/usr/lib/python2.7/plat-linux2',
>>>  '/usr/lib/python2.7/lib-tk',
>>>  '/usr/lib/python2.7/lib-old',
>>>  '/usr/lib/python2.7/lib-dynload',
>>>  '/usr/local/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages/PIL',
>>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>>  '/usr/lib/pymodules/python2.7',
>>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>>>
>>>
>>>  --
>>> 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/-/C1nnWqPBZkwJ.
>>> 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.
>>>
>>
>>
>>
>> --
>> Marcin Tustin
>> Tel: 07773 787 105
>>
>>  --
>> 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.
>



-- 
Marcin Tustin
Tel: 07773 787 105

-- 
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 render a modeladmin dynamically?

2012-06-22 Thread Thomas Weholt
In a view, I need to get a modeladmin for a model provided
dynamically, change some of the attributes  of the modeladmin ( add an
aggregated field to the queryset, order the queryset by that field and
add a column for that new field in the list_display of the modeladmin
) and render the request using a custom template extending the normal
change_list template. I cannot add these things to the modeladmin of
the models in question, it has to be done at runtime.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Import error

2012-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hi Emily,

Here is a really good article (written by the very people who contribute to
this list) on how to ask questions on the mailing list:

https://code.djangoproject.com/wiki/UsingTheMailingList

It tells you what you can do to try and resolve the issue yourself, and
what sort of information you need to provide so we can assist.

Cal


On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin wrote:

> Dear Emily,
>
> Do you expect us to already have a copy of your code? If not, we need to
> have a short, self-contained, and correct example demonstrating your issue.
>
> Marcin
>
>
> On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:
>
>> Dear Marcin,
>>
>> I do not understand.
>> I think I have done everything right and I am trying to find
>> the source of the error where if there is someone who has
>> experienced it they might be knowing where it is coming from..
>>
>> Emily
>>
>>
>> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin 
>> wrote:
>>
>>> Please take a look at: Short, Self Contained, Correct 
>>> Example
>>>
>>> There's also some good advice at: What have you tried? - Matt 
>>> Gemmell
>>>
>>>
>>> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>>>
 Hi django users,
 I seem to have gotten a problem.

 I created a helper class in my project and I have failed to import
 the methods in it. Please help...

 This is the error I get...

 ImportError at /admin/

 cannot import name random_password

  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
 Version: 1.3.1  Exception Type: ImportError  Exception Value:

 cannot import name random_password

  Exception Location: 
 /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
 in , line 1  Python Executable: /usr/bin/python  Python
 Version: 2.7.2  Python Path:

 ['/home/emily/Documents/AskJarvis/Etutor',
  '/usr/lib/python2.7',
  '/usr/lib/python2.7/plat-linux2',
  '/usr/lib/python2.7/lib-tk',
  '/usr/lib/python2.7/lib-old',
  '/usr/lib/python2.7/lib-dynload',
  '/usr/local/lib/python2.7/dist-packages',
  '/usr/lib/python2.7/dist-packages',
  '/usr/lib/python2.7/dist-packages/PIL',
  '/usr/lib/python2.7/dist-packages/gst-0.10',
  '/usr/lib/python2.7/dist-packages/gtk-2.0',
  '/usr/lib/pymodules/python2.7',
  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']


  --
 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/-/C1nnWqPBZkwJ.
 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.

>>>
>>>
>>>
>>> --
>>> Marcin Tustin
>>> Tel: 07773 787 105
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> 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.



Where I am wrong in loading static files ?

2012-06-22 Thread surya
This is my project folder hierarchy:

project \
   project \ 
  __init__.py
  settings.py
  urls.py
  views.py
  ... etc
   templates \
   css \
index_css.css

   media \ 
 logo.png

   templates \ 
 home.html
   manage.py


So, these are the settings I made in "settings.py"

currDir = os.path.dirname(__file__)
templateDir_media = 
os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "media")
templateDir_css = 
os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "css")

STATICFILES_DIRS = (
templateDir_media,
templateDir_css,
"d:/code/projects-dev/readdme/"
)
## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT

The HTML source file contains:

Image URL:  src="../media/logo.png"
CSS URL : href="../css/twoColFixLtHdr.css"


So, when I am loading the page, I am unable to find the logo and CSS 
 settings.. 

Where I am going wrong and how should I fix it?




















-- 
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/-/QKcKdIHVqY0J.
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: Any clue why Facebook iframe would be blank?

2012-06-22 Thread Kurtis Mullins
On Fri, Jun 22, 2012 at 3:59 AM, Gabriel - Iulian Dumbrava <
gabriel.dumbr...@gmail.com> wrote:

> Hi,
> I think something similar happen to me when I set the width of the iframe
> to be too narrow. I'm not very sure, but maybe you cand check it out.
>
> Gabriel
>

Hey Garbiel,

I actually figured out the issue on my end. From what I gather, uWSGI
doesn't handle small POST data sizes well. I had to change a couple of
uWSGI configuration parameters (as seen on Stackoverflow).
As far as I can tell -- my stuff is all good now, both in the Fluid and
fixed-size layouts.

If you need any help debugging yours, let me know! And thanks for the
feedback.

- Kurtis Mullins

-- 
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: Import error

2012-06-22 Thread Emily
so your point is that I should post my code.
When I did that some time, I was told that
the people who were trying to help me did not
want to know what is in my code so I should just
explain what I want them to help me with.
But thank you any way, you point has been driven home.

On Fri, Jun 22, 2012 at 3:58 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi Emily,
>
> Here is a really good article (written by the very people who contribute
> to this list) on how to ask questions on the mailing list:
>
> https://code.djangoproject.com/wiki/UsingTheMailingList
>
> It tells you what you can do to try and resolve the issue yourself, and
> what sort of information you need to provide so we can assist.
>
> Cal
>
>
> On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin wrote:
>
>> Dear Emily,
>>
>> Do you expect us to already have a copy of your code? If not, we need to
>> have a short, self-contained, and correct example demonstrating your issue.
>>
>> Marcin
>>
>>
>> On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:
>>
>>> Dear Marcin,
>>>
>>> I do not understand.
>>> I think I have done everything right and I am trying to find
>>> the source of the error where if there is someone who has
>>> experienced it they might be knowing where it is coming from..
>>>
>>> Emily
>>>
>>>
>>> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin 
>>> wrote:
>>>
 Please take a look at: Short, Self Contained, Correct 
 Example

 There's also some good advice at: What have you tried? - Matt 
 Gemmell


 On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:

> Hi django users,
> I seem to have gotten a problem.
>
> I created a helper class in my project and I have failed to import
> the methods in it. Please help...
>
> This is the error I get...
>
> ImportError at /admin/
>
> cannot import name random_password
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>
> cannot import name random_password
>
>  Exception Location: 
> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
> in , line 1  Python Executable: /usr/bin/python  Python
> Version: 2.7.2  Python Path:
>
> ['/home/emily/Documents/AskJarvis/Etutor',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/usr/lib/python2.7/lib-old',
>  '/usr/lib/python2.7/lib-dynload',
>  '/usr/local/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages/PIL',
>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>  '/usr/lib/pymodules/python2.7',
>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>
>
>  --
> 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/-/C1nnWqPBZkwJ.
> 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.
>



 --
 Marcin Tustin
 Tel: 07773 787 105

  --
 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.
>>>
>>
>>
>>
>> --
>> Marcin Tustin
>> Tel: 07773 787 105
>>
>>  --
>> 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 option

Re: Django learning

2012-06-22 Thread Daniel Roseman
On Friday, 22 June 2012 07:15:53 UTC+1, lovetoprogram wrote:
>
> I tried to do this according the tutorial. 
> >>> from django import template 
> >>> t = template.Template('My name is {{ name }}.') 
> >>> c = template.Context({'name': 'Adrian'}) 
> >>> print t.render(c) 
> My name is Adrian. 
> >>> c = template.Context({'name': 'Fred'}) 
> >>> print t.render(c) 
> My name is Fred. 
>
> But I got this error 
> >>> t = template.Template('My name is {{ name }}.') 
>
> Traceback (most recent call last): 
>   File "", line 1, in  
> t = template.Template('My name is {{ name }}.') 
>   File "C:\Python27\lib\site-packages\django\template\base.py", line 
> 123, in __init__ 
> if settings.TEMPLATE_DEBUG and origin is None: 
>   File "C:\Python27\lib\site-packages\django\utils\functional.py", 
> line 184, in inner 
> self._setup() 
>   File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 
> 40, in _setup 
> raise ImportError("Settings cannot be imported, because 
> environment variable %s is undefined." % ENVIRONMENT_VARIABLE) 
> ImportError: Settings cannot be imported, because environment variable 
> DJANGO_SETTINGS_MODULE is undefined. 
>
> Any help 
>
> Cheers


You're supposed to load the shell with `./manage.py shell` rather than 
going directly into Python. That is explained in the tutorial.
--
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/-/Dw38PuKtt7UJ.
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: Import error

2012-06-22 Thread Kurtis Mullins
Hey emily,

I think the other guys were just wanting to see your import statement
that's broken. It should be something along these lines if you want to give
it a try:

from myproject.myapp.myhelpers import random_password

Of course you'd substitute your project name, the application name, and
then the python file that your "random_password" function/class is saved in.

Let me know if you need any more help!

Good luck!
- Kurtis Mullins

On Fri, Jun 22, 2012 at 10:19 AM, Emily  wrote:

> so your point is that I should post my code.
> When I did that some time, I was told that
> the people who were trying to help me did not
> want to know what is in my code so I should just
> explain what I want them to help me with.
> But thank you any way, you point has been driven home.
>
>
> On Fri, Jun 22, 2012 at 3:58 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hi Emily,
>>
>> Here is a really good article (written by the very people who contribute
>> to this list) on how to ask questions on the mailing list:
>>
>> https://code.djangoproject.com/wiki/UsingTheMailingList
>>
>> It tells you what you can do to try and resolve the issue yourself, and
>> what sort of information you need to provide so we can assist.
>>
>> Cal
>>
>>
>> On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin 
>> wrote:
>>
>>> Dear Emily,
>>>
>>> Do you expect us to already have a copy of your code? If not, we need to
>>> have a short, self-contained, and correct example demonstrating your issue.
>>>
>>> Marcin
>>>
>>>
>>> On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:
>>>
 Dear Marcin,

 I do not understand.
 I think I have done everything right and I am trying to find
 the source of the error where if there is someone who has
 experienced it they might be knowing where it is coming from..

 Emily


 On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin >>> > wrote:

> Please take a look at: Short, Self Contained, Correct 
> Example
>
> There's also some good advice at: What have you tried? - Matt 
> Gemmell
>
>
> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>
>> Hi django users,
>> I seem to have gotten a problem.
>>
>> I created a helper class in my project and I have failed to import
>> the methods in it. Please help...
>>
>> This is the error I get...
>>
>> ImportError at /admin/
>>
>> cannot import name random_password
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
>> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>>
>> cannot import name random_password
>>
>>  Exception Location: 
>> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
>> in , line 1  Python Executable: /usr/bin/python  Python
>> Version: 2.7.2  Python Path:
>>
>> ['/home/emily/Documents/AskJarvis/Etutor',
>>  '/usr/lib/python2.7',
>>  '/usr/lib/python2.7/plat-linux2',
>>  '/usr/lib/python2.7/lib-tk',
>>  '/usr/lib/python2.7/lib-old',
>>  '/usr/lib/python2.7/lib-dynload',
>>  '/usr/local/lib/python2.7/dist-packages',
>>  '/usr/lib/python2.7/dist-packages',
>>  '/usr/lib/python2.7/dist-packages/PIL',
>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>  '/usr/lib/pymodules/python2.7',
>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>>
>>
>>  --
>> 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/-/C1nnWqPBZkwJ.
>> 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.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> 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 "Djang

Taking advantage of multiple cores

2012-06-22 Thread Jonathan Hayward
Will a slightly older version of Pinax, installed on top of a newer version
of Django, take advantage (or be configurable to take advantage) of
multiple cores?

In other words, if one request is rendering and another request comes in
while the first is rendering, will Django or Pinax offload the second
request to another core?

If this isn't the default, can it be enabled, and are there race conditions
or other risks?

Thanks,
-- 
[image: Christos Jonathan Hayward] 
Jonathan Hayward, an Orthodox Christian author.

*Amazon*  • Author
Bio
 • *Email * •
Facebook
 • Google Plus  •
*Kindle
* • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site. *See a random page! *

-- 
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: Taking advantage of multiple cores

2012-06-22 Thread Oleg Korsak
That's what mod_wsgi does!

2012/6/22 Jonathan Hayward 

> Will a slightly older version of Pinax, installed on top of a newer
> version of Django, take advantage (or be configurable to take advantage) of
> multiple cores?
>
> In other words, if one request is rendering and another request comes in
> while the first is rendering, will Django or Pinax offload the second
> request to another core?
>
> If this isn't the default, can it be enabled, and are there race
> conditions or other risks?
>
> Thanks,
> --
> [image: Christos Jonathan Hayward] 
> Jonathan Hayward, an Orthodox Christian author.
>
> *Amazon*  • Author 
> Bio
>  • *Email * • 
> Facebook
>  • Google Plus  • 
> *Kindle
> * • LinkedIn  • 
> Twitter
>  • *Web * • What's 
> New?
> I invite you to visit my "theology, literature, and other creative works"
> site. *See a random page! *
>
>  --
> 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: Taking advantage of multiple cores

2012-06-22 Thread Javier Guerra Giraldez
On Fri, Jun 22, 2012 at 9:35 AM, Oleg Korsak
 wrote:
>
> That's what mod_wsgi does!

exactly.

specifically, Django is by itself, a shared-nothing library.  that
means that you can run many instances of it.  not only on several
cores but also on many different hosts.

Just be sure that anything that works 'outside' the request/response
cycle is is managed in a properly shared storage.  mostly the
database, cache (memcached/Redis), queue manager...

stay clear from in-process memory storage (global variables, thread
local storage, etc) and your app will be trivially scalable.  your
bottleneck would likely be the shared data, but any good RDMS go far
on big machines, especially if you handle right the cache and queue
layers.


--
Javier

-- 
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: Import error

2012-06-22 Thread Emily
This is the views.py file

from helpers import random_password
from django.views.generic.edit import CreateView
from django.views.generic.list import ListView
from Prototype.forms import StudentForm, LecturerForm, PaymentForm
from Prototype.models import Guideline, Student, Lecturer, Payment
from Prototype.models import Course

class GuidelineListView(ListView):
model = Guideline
template_name = 'content.html'
context_object_name = 'guidelines'

class Registration(CreateView):
model = Student
form_class = StudentForm
template_name = "newAccount.html"
success_url = "/Payment/"
context_object_name = 'form'

def send_sms(self):
#send sms
password = random_password()

def post(self):
'''generate password and send it to the user.'''
return Super(Register, self).post()

class NewLecturer(CreateView):
model = Lecturer
form_class = LecturerForm
template_name = "newAccount.html"
success_url = "/login/"
context_object_name = 'lecturer_form'

class CourseListView(ListView):
model = Course
template_name = 'index.html'
context_object_name = 'courses'

class Payment(CreateView):
model = Payment
form_class = PaymentForm
template_name = 'Payment.html'
success_url = "/login/"
context_object_name = 'payments'

On Fri, Jun 22, 2012 at 5:25 PM, Kurtis Mullins wrote:

> Hey emily,
>
> I think the other guys were just wanting to see your import statement
> that's broken. It should be something along these lines if you want to give
> it a try:
>
> from myproject.myapp.myhelpers import random_password
>
> Of course you'd substitute your project name, the application name, and
> then the python file that your "random_password" function/class is saved in.
>
> Let me know if you need any more help!
>
> Good luck!
> - Kurtis Mullins
>
>
> On Fri, Jun 22, 2012 at 10:19 AM, Emily  wrote:
>
>> so your point is that I should post my code.
>> When I did that some time, I was told that
>> the people who were trying to help me did not
>> want to know what is in my code so I should just
>> explain what I want them to help me with.
>> But thank you any way, you point has been driven home.
>>
>>
>> On Fri, Jun 22, 2012 at 3:58 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Hi Emily,
>>>
>>> Here is a really good article (written by the very people who contribute
>>> to this list) on how to ask questions on the mailing list:
>>>
>>> https://code.djangoproject.com/wiki/UsingTheMailingList
>>>
>>> It tells you what you can do to try and resolve the issue yourself, and
>>> what sort of information you need to provide so we can assist.
>>>
>>> Cal
>>>
>>>
>>> On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin 
>>> wrote:
>>>
 Dear Emily,

 Do you expect us to already have a copy of your code? If not, we need
 to have a short, self-contained, and correct example demonstrating your
 issue.

 Marcin


 On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:

> Dear Marcin,
>
> I do not understand.
> I think I have done everything right and I am trying to find
> the source of the error where if there is someone who has
> experienced it they might be knowing where it is coming from..
>
> Emily
>
>
> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin <
> marcin.tus...@gmail.com> wrote:
>
>> Please take a look at: Short, Self Contained, Correct 
>> Example
>>
>> There's also some good advice at: What have you tried? - Matt 
>> Gemmell
>>
>>
>> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>>
>>> Hi django users,
>>> I seem to have gotten a problem.
>>>
>>> I created a helper class in my project and I have failed to import
>>> the methods in it. Please help...
>>>
>>> This is the error I get...
>>>
>>> ImportError at /admin/
>>>
>>> cannot import name random_password
>>>
>>>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
>>> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>>>
>>> cannot import name random_password
>>>
>>>  Exception Location: 
>>> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
>>> in , line 1  Python Executable: /usr/bin/python  Python
>>> Version: 2.7.2  Python Path:
>>>
>>> ['/home/emily/Documents/AskJarvis/Etutor',
>>>  '/usr/lib/python2.7',
>>>  '/usr/lib/python2.7/plat-linux2',
>>>  '/usr/lib/python2.7/lib-tk',
>>>  '/usr/lib/python2.7/lib-old',
>>>  '/usr/lib/python2.7/lib-dynload',
>>>  '/usr/local/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages/PIL',
>>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>

Re: Import error

2012-06-22 Thread Emily
This is the class I created...

import string
import random

class Helpers:

def random_password():
'''a method to generate random password'''
lengthOfPassword = random.randint(6,10)
password_len = lengthOfPassword
password = []

for group in (string.ascii_letters, string.punctuation,
string.digits):
password += random.sample(group, 3)

password += random.sample(
 string.ascii_letters + string.punctuation + string.digits,
 password_len - len(password))

random.shuffle(password)
password = ''.join(password)

return password

def sendSMS():
'''a method to send sms to a user'''
pass

On Fri, Jun 22, 2012 at 5:46 PM, Emily  wrote:

> This is the views.py file
>
> from helpers import random_password
> from django.views.generic.edit import CreateView
> from django.views.generic.list import ListView
> from Prototype.forms import StudentForm, LecturerForm, PaymentForm
> from Prototype.models import Guideline, Student, Lecturer, Payment
> from Prototype.models import Course
>
> class GuidelineListView(ListView):
> model = Guideline
> template_name = 'content.html'
> context_object_name = 'guidelines'
>
> class Registration(CreateView):
> model = Student
> form_class = StudentForm
> template_name = "newAccount.html"
> success_url = "/Payment/"
> context_object_name = 'form'
>
> def send_sms(self):
> #send sms
> password = random_password()
>
> def post(self):
> '''generate password and send it to the user.'''
> return Super(Register, self).post()
>
> class NewLecturer(CreateView):
> model = Lecturer
> form_class = LecturerForm
> template_name = "newAccount.html"
> success_url = "/login/"
> context_object_name = 'lecturer_form'
>
> class CourseListView(ListView):
> model = Course
> template_name = 'index.html'
> context_object_name = 'courses'
>
> class Payment(CreateView):
> model = Payment
> form_class = PaymentForm
> template_name = 'Payment.html'
> success_url = "/login/"
> context_object_name = 'payments'
>
>
> On Fri, Jun 22, 2012 at 5:25 PM, Kurtis Mullins 
> wrote:
>
>> Hey emily,
>>
>> I think the other guys were just wanting to see your import statement
>> that's broken. It should be something along these lines if you want to give
>> it a try:
>>
>> from myproject.myapp.myhelpers import random_password
>>
>> Of course you'd substitute your project name, the application name, and
>> then the python file that your "random_password" function/class is saved in.
>>
>> Let me know if you need any more help!
>>
>> Good luck!
>> - Kurtis Mullins
>>
>>
>> On Fri, Jun 22, 2012 at 10:19 AM, Emily  wrote:
>>
>>> so your point is that I should post my code.
>>> When I did that some time, I was told that
>>> the people who were trying to help me did not
>>> want to know what is in my code so I should just
>>> explain what I want them to help me with.
>>> But thank you any way, you point has been driven home.
>>>
>>>
>>> On Fri, Jun 22, 2012 at 3:58 PM, Cal Leeming [Simplicity Media Ltd] <
>>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>>
 Hi Emily,

 Here is a really good article (written by the very people who
 contribute to this list) on how to ask questions on the mailing list:

 https://code.djangoproject.com/wiki/UsingTheMailingList

 It tells you what you can do to try and resolve the issue yourself, and
 what sort of information you need to provide so we can assist.

 Cal


 On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin >>> > wrote:

> Dear Emily,
>
> Do you expect us to already have a copy of your code? If not, we need
> to have a short, self-contained, and correct example demonstrating your
> issue.
>
> Marcin
>
>
> On Fri, Jun 22, 2012 at 8:43 AM, Emily  wrote:
>
>> Dear Marcin,
>>
>> I do not understand.
>> I think I have done everything right and I am trying to find
>> the source of the error where if there is someone who has
>> experienced it they might be knowing where it is coming from..
>>
>> Emily
>>
>>
>> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin <
>> marcin.tus...@gmail.com> wrote:
>>
>>> Please take a look at: Short, Self Contained, Correct 
>>> Example
>>>
>>> There's also some good advice at: What have you tried? - Matt
>>> Gemmell 
>>>
>>>
>>> On Fri, Jun 22, 2012 at 8:10 AM, Emily N  wrote:
>>>
 Hi django users,
 I seem to have gotten a problem.

 I created a helper class in my project and I have failed to import
 the methods in it. Please help...

 This is the error I get...

 ImportError at /admin/

>

Re: Import error

2012-06-22 Thread Adrian Bool

Hi Emily,

On 22 Jun 2012, at 15:46, Emily wrote:

> This is the class I created...
> 
> import string
> import random
> 
> class Helpers:
> 
> def random_password():

Take random_password outside of the Helpers class and you should be OK.  On the 
import statement you need to refer to a 'top level object' within the imported 
file.  The only top level object you have is the class  Helpers - which it 
doens't look like you really need.

Cheers,

aid

-- 
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: Duplicate rows with same key in DB?

2012-06-22 Thread Daniel Roseman
On Friday, 22 June 2012 06:23:32 UTC+1, ydjango wrote:
>
> I have code as
>
> view_a(request):
>    Populate my_a, my_b and my_c...
>   try:
>   tp = TP.objects.get(a__exact = my_a, b__exact = my_b)
>   except TP.DoesNotExist, e:
>  tp = TP()
>  tp.a = my_a
>  tp.b = my_b
>  tp.c = my_c
>  tp.save()
>   else:
>  tp.c = my_c
>  tp.save()
>
> This view is called by ajax calls. TP is a django model and mysql db. 
> I am using django 1.1.4/ python2.5/mod_wsgi2.5,
>
> I find that in, one case, two rows with same value of  a and b has been 
> created in DB. ( value of c was different)
> What could have caused it? 
>
> Any clues or hints on how to track down this problem or what to look for 
> will be appreciated.
>
>
You probably have a race condition. You should use the built-in 
`get_or_create` manager method, which helps to minimize that sort of thing 
(it's not perfect, but it's better than coding it yourself).
--
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/-/HTccZPk06t8J.
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: Import error

2012-06-22 Thread Daniel Roseman
On Friday, 22 June 2012 15:49:31 UTC+1, aid wrote:
>
>
> Hi Emily, 
>
> On 22 Jun 2012, at 15:46, Emily wrote: 
>
> > This is the class I created... 
> > 
> > import string 
> > import random 
> > 
> > class Helpers: 
> > 
> > def random_password(): 
>
> Take random_password outside of the Helpers class and you should be OK. 
>  On the import statement you need to refer to a 'top level object' within 
> the imported file.  The only top level object you have is the class 
>  Helpers - which it doens't look like you really need. 
>
> Cheers, 
>
> aid 
>
>
+1. Python is not Java. Don't use a class unless you're encapsulating data.
--
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/-/eV6jxgDm7cgJ.
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 learning

2012-06-22 Thread Kurtis Mullins
>
> You're supposed to load the shell with `./manage.py shell` rather than
> going directly into Python. That is explained in the tutorial.
> --
> DR.
>
> +1 -- However, I recommend installing the package "ipython" when using the
Django Shell. For example, run: "pip install ipython".

This will give you auto-completion. So if you started typing something like
"models." and hit tab, it'd show you all of the available methods and
classes you can 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.



Re: Import error

2012-06-22 Thread Kurtis Mullins
+1 on pulling the "random_password()" method out of the Class and setting
it up as a module object.
I'd still suggest using this sort of an import statement on it, though:

from myproject.myapp.helpers import random_password

Where in this example you'd substitute your Project name with "myproject",
the app name with "myapp" and the this particular python file with
"helpers.py".

On Fri, Jun 22, 2012 at 10:54 AM, Daniel Roseman wrote:

> On Friday, 22 June 2012 15:49:31 UTC+1, aid wrote:
>>
>>
>> Hi Emily,
>>
>> On 22 Jun 2012, at 15:46, Emily wrote:
>>
>> > This is the class I created...
>> >
>> > import string
>> > import random
>> >
>> > class Helpers:
>> >
>> > def random_password():
>>
>> Take random_password outside of the Helpers class and you should be OK.
>>  On the import statement you need to refer to a 'top level object' within
>> the imported file.  The only top level object you have is the class
>>  Helpers - which it doens't look like you really need.
>>
>> Cheers,
>>
>> aid
>>
>>
> +1. Python is not Java. Don't use a class unless you're encapsulating data.
> --
> 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/-/eV6jxgDm7cgJ.
>
> 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: Duplicate rows with same key in DB?

2012-06-22 Thread Kurtis Mullins
You could also put a unique_together statement in your Model. If you do
this, you'll need to update your database as well to enforce the constraint
at the database level.

On Fri, Jun 22, 2012 at 10:52 AM, Daniel Roseman wrote:

> On Friday, 22 June 2012 06:23:32 UTC+1, ydjango wrote:
>>
>> I have code as
>>
>> view_a(request):
>>    Populate my_a, my_b and my_c...
>>   try:
>>   tp = TP.objects.get(a__exact = my_a, b__exact = my_b)
>>   except TP.DoesNotExist, e:
>>  tp = TP()
>>  tp.a = my_a
>>  tp.b = my_b
>>  tp.c = my_c
>>  tp.save()
>>   else:
>>  tp.c = my_c
>>  tp.save()
>>
>> This view is called by ajax calls. TP is a django model and mysql db.
>> I am using django 1.1.4/ python2.5/mod_wsgi2.5,
>>
>> I find that in, one case, two rows with same value of  a and b has been
>> created in DB. ( value of c was different)
>> What could have caused it?
>>
>> Any clues or hints on how to track down this problem or what to look for
>> will be appreciated.
>>
>>
> You probably have a race condition. You should use the built-in
> `get_or_create` manager method, which helps to minimize that sort of thing
> (it's not perfect, but it's better than coding it yourself).
> --
> 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/-/HTccZPk06t8J.
>
> 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: Taking advantage of multiple cores

2012-06-22 Thread Kurtis Mullins
Basically, you just need to run multiple instances of your Django
web-application. I've never used Apache for this (I'm an Nginx + uWSGI fan,
myself) but you'd just run multiple worker processes and your WSGI handler
should "balance" between them.

Like the others mentioned, make sure to use a common cache like Memcache.

On Fri, Jun 22, 2012 at 10:43 AM, Javier Guerra Giraldez  wrote:

> On Fri, Jun 22, 2012 at 9:35 AM, Oleg Korsak
>  wrote:
> >
> > That's what mod_wsgi does!
>
> exactly.
>
> specifically, Django is by itself, a shared-nothing library.  that
> means that you can run many instances of it.  not only on several
> cores but also on many different hosts.
>
> Just be sure that anything that works 'outside' the request/response
> cycle is is managed in a properly shared storage.  mostly the
> database, cache (memcached/Redis), queue manager...
>
> stay clear from in-process memory storage (global variables, thread
> local storage, etc) and your app will be trivially scalable.  your
> bottleneck would likely be the shared data, but any good RDMS go far
> on big machines, especially if you handle right the cache and queue
> layers.
>
>
> --
> Javier
>
> --
> 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: Where I am wrong in loading static files ?

2012-06-22 Thread Kurtis Mullins
Here's a vaguely similar post:
http://stackoverflow.com/questions/6409920/django-static-files-from-app-directories

Like one of the respondents recommended, try adding a "print
str(STATICFILES_DIRS)" in your settings.py and then run "runserver" so you
can see what actual directories are being included.

On Fri, Jun 22, 2012 at 9:53 AM, surya  wrote:

> This is my project folder hierarchy:
>
> project \
>project \
>   __init__.py
>   settings.py
>   urls.py
>   views.py
>   ... etc
>templates \
>css \
> index_css.css
>
>media \
>  logo.png
>
>templates \
>  home.html
>manage.py
>
>
> So, these are the settings I made in "settings.py"
>
> currDir = os.path.dirname(__file__)
> templateDir_media =
> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "media")
> templateDir_css =
> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "css")
>
> STATICFILES_DIRS = (
> templateDir_media,
> templateDir_css,
> "d:/code/projects-dev/readdme/"
> )
> ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT
>
> The HTML source file contains:
>
> Image URL:  src="../media/logo.png"
> CSS URL : href="../css/twoColFixLtHdr.css"
>
>
> So, when I am loading the page, I am unable to find the logo and CSS
>  settings..
>
> Where I am going wrong and how should I fix it?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  --
> 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/-/QKcKdIHVqY0J.
> 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: Import error

2012-06-22 Thread Emily
Kurtis, Adrian and Daniel,

thank you so much for your help, it actually worked
I have programmed in java 70% of my life

Now I want to send sms to my users when they sign up
in the website. There is some package I have seen which looks
like it is from an email to the phone. Does it work with messages
from a website to a phone...

Emily

On Fri, Jun 22, 2012 at 5:58 PM, Kurtis Mullins wrote:

> +1 on pulling the "random_password()" method out of the Class and setting
> it up as a module object.
> I'd still suggest using this sort of an import statement on it, though:
>
> from myproject.myapp.helpers import random_password
>
> Where in this example you'd substitute your Project name with "myproject",
> the app name with "myapp" and the this particular python file with
> "helpers.py".
>
>
> On Fri, Jun 22, 2012 at 10:54 AM, Daniel Roseman wrote:
>
>> On Friday, 22 June 2012 15:49:31 UTC+1, aid wrote:
>>>
>>>
>>> Hi Emily,
>>>
>>> On 22 Jun 2012, at 15:46, Emily wrote:
>>>
>>> > This is the class I created...
>>> >
>>> > import string
>>> > import random
>>> >
>>> > class Helpers:
>>> >
>>> > def random_password():
>>>
>>> Take random_password outside of the Helpers class and you should be OK.
>>>  On the import statement you need to refer to a 'top level object' within
>>> the imported file.  The only top level object you have is the class
>>>  Helpers - which it doens't look like you really need.
>>>
>>> Cheers,
>>>
>>> aid
>>>
>>>
>> +1. Python is not Java. Don't use a class unless you're encapsulating
>> data.
>> --
>> 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/-/eV6jxgDm7cgJ.
>>
>> 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.
>

-- 
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: Select * from users,country where country.id = users.id in Django using amin.contrib

2012-06-22 Thread django noob
Bump!
 




On Monday, June 18, 2012 9:13:50 PM UTC+1, django noob wrote:
>
> Greetings Django Experts! 
>
> Say for example i have the following on my models.py 
>
>
> class Country(models.Model): 
> name = models.CharField(max_length=50) 
>
> def __unicode__(self): 
> return u'%s %s' % (self.name, self.ID) 
>
> class Meta: 
> verbose_name = 'Countries' 
>
> class Users(models.Model): 
> name = models.CharField(max_length=50) 
> cUsers = models.ForeignKey(Country) 
>
> def __unicode__(self): 
> return self.name 
>
> class Meta: 
> verbose_name = 'Users on a country' 
>
> class GoalsinCountry(models.Model): 
> gCountry = models.ForeignKey(Country) 
> name = models.CharField(max_length=50) 
> descr = models.TextField(blank=True, null=True) 
>
> def __unicode__(self): 
> return self.name 
> class Meta: 
> verbose_name = 'Goals Topic' 
>
>
>
> How would you configure this in GoalsinCountry to return only users in 
> a particular country and save this to 
> GoalsinCountry Table? 
>
> if i use gCountry = models.ForeignKey(Users) 
> I would get a list of all users, i am interested in fitering to users 
> on a particular country?? 
>
> Please advice 
>
> Thank you 
>

-- 
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/-/6Ekb7926kzkJ.
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: Select * from users,country where country.id = users.id in Django using amin.contrib

2012-06-22 Thread Kurtis Mullins
Hey,

Here's some sample code just from reading what you've provided.

from django.contrib.auth.models import User
users_in_country = User.objects.filter(cUser__name="some_country_name")
if bool(users_in_country): # Check to make sure there's at least one User
in the Country
for user in users:
goal = GoalsinCountry.objects.create(gCountry=user.cUsers,
name="Some Name", descr="Some Description")
goal.save() # Possibly not needed, I'd have to run the code to check

With that said, I'd recommend changing the naming conventions of your Model
fields. For example:

User
- name
- country

Goals
- name
- description
- country

Country
- name

On Fri, Jun 22, 2012 at 11:28 AM, django noob  wrote:

> Bump!
>
>
>
>
>
>
> On Monday, June 18, 2012 9:13:50 PM UTC+1, django noob wrote:
>>
>> Greetings Django Experts!
>>
>> Say for example i have the following on my models.py
>>
>>
>> class Country(models.Model):
>> name = models.CharField(max_length=**50)
>>
>> def __unicode__(self):
>> return u'%s %s' % (self.name, self.ID)
>>
>> class Meta:
>> verbose_name = 'Countries'
>>
>> class Users(models.Model):
>> name = models.CharField(max_length=**50)
>> cUsers = models.ForeignKey(Country)
>>
>> def __unicode__(self):
>> return self.name
>>
>> class Meta:
>> verbose_name = 'Users on a country'
>>
>> class GoalsinCountry(models.Model):
>> gCountry = models.ForeignKey(Country)
>> name = models.CharField(max_length=**50)
>> descr = models.TextField(blank=True, null=True)
>>
>> def __unicode__(self):
>> return self.name
>> class Meta:
>> verbose_name = 'Goals Topic'
>>
>>
>>
>> How would you configure this in GoalsinCountry to return only users in
>> a particular country and save this to
>> GoalsinCountry Table?
>>
>> if i use gCountry = models.ForeignKey(Users)
>> I would get a list of all users, i am interested in fitering to users
>> on a particular country??
>>
>> Please advice
>>
>> Thank you
>>
>  --
> 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/-/6Ekb7926kzkJ.
>
> 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: Select * from users,country where country.id = users.id in Django using amin.contrib

2012-06-22 Thread Kurtis Mullins
>
>
> With that said, I'd recommend changing the naming conventions of your
> Model fields. For example:
>
> User
> - name
> - country
>
> Goals
> - name
> - description
> - country
>
> Country
> - name
>

Sorry, wanted to mention a small fix on what I imagine would be better
naming conventions (just so your code is clearer and easier to query)

Goals
- name # Is this the user's name? Then why not just make this a foreign key
to a User? so maybe user = models.ForeignKey(User)

Also, some docs on querying django models:
https://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects

-- 
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: Where I am wrong in loading static files ?

2012-06-22 Thread surya
Well.. apart from that mistake..

Is everything alright??

On Friday, June 22, 2012 8:37:55 PM UTC+5:30, Kurtis wrote:
>
> Here's a vaguely similar post: 
> http://stackoverflow.com/questions/6409920/django-static-files-from-app-directories
>
> Like one of the respondents recommended, try adding a "print 
> str(STATICFILES_DIRS)" in your settings.py and then run "runserver" so you 
> can see what actual directories are being included.
>
> On Fri, Jun 22, 2012 at 9:53 AM, surya  wrote:
>
>> This is my project folder hierarchy:
>>
>> project \
>>project \ 
>>   __init__.py
>>   settings.py
>>   urls.py
>>   views.py
>>   ... etc
>>templates \
>>css \
>> index_css.css
>>
>>media \ 
>>  logo.png
>>
>>templates \ 
>>  home.html
>>manage.py
>>
>>
>> So, these are the settings I made in "settings.py"
>>
>> currDir = os.path.dirname(__file__)
>> templateDir_media = 
>> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "media")
>> templateDir_css = 
>> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "css")
>>
>> STATICFILES_DIRS = (
>> templateDir_media,
>> templateDir_css,
>> "d:/code/projects-dev/readdme/"
>> )
>> ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT
>>
>> The HTML source file contains:
>>
>> Image URL:  src="../media/logo.png"
>> CSS URL : href="../css/twoColFixLtHdr.css"
>>
>>
>> So, when I am loading the page, I am unable to find the logo and CSS 
>>  settings.. 
>>
>> Where I am going wrong and how should I fix it?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>  -- 
>> 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/-/QKcKdIHVqY0J.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/X2Bd6g9yPPMJ.
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: Where I am wrong in loading static files ?

2012-06-22 Thread Kurtis Mullins
For your URLs, use {{ STATIC_URL }}/css/index_css.css (or maybe {{
STATIC_URL }}/app_name/css/index_css.css -- I've never tried this approach
before)

On Fri, Jun 22, 2012 at 11:55 AM, surya  wrote:

> Well.. apart from that mistake..
>
> Is everything alright??
>
>
> On Friday, June 22, 2012 8:37:55 PM UTC+5:30, Kurtis wrote:
>>
>> Here's a vaguely similar post: http://stackoverflow.**
>> com/questions/6409920/django-**static-files-from-app-**directories
>>
>> Like one of the respondents recommended, try adding a "print
>> str(STATICFILES_DIRS)" in your settings.py and then run "runserver" so you
>> can see what actual directories are being included.
>>
>> On Fri, Jun 22, 2012 at 9:53 AM, surya  wrote:
>>
>>> This is my project folder hierarchy:
>>>
>>> project \
>>>project \
>>>   __init__.py
>>>   settings.py
>>>   urls.py
>>>   views.py
>>>   ... etc
>>>templates \
>>>css \
>>> index_css.css
>>>
>>>media \
>>>  logo.png
>>>
>>>templates \
>>>  home.html
>>>manage.py
>>>
>>>
>>> So, these are the settings I made in "settings.py"
>>>
>>> currDir = os.path.dirname(__file__)
>>> templateDir_media = os.path.join(os.path.join(os.**
>>> path.split(currDir)[0],"**Templates"), "media")
>>> templateDir_css = os.path.join(os.path.join(os.**
>>> path.split(currDir)[0],"**Templates"), "css")
>>>
>>> STATICFILES_DIRS = (
>>> templateDir_media,
>>> templateDir_css,
>>> "d:/code/projects-dev/readdme/**"
>>> )
>>> ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT
>>>
>>> The HTML source file contains:
>>>
>>> Image URL:  src="../media/logo.png"
>>> CSS URL : href="../css/twoColFixLtHdr.**css"
>>>
>>>
>>> So, when I am loading the page, I am unable to find the logo and CSS
>>>  settings..
>>>
>>> Where I am going wrong and how should I fix it?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>  --
>>> 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/-/**QKcKdIHVqY0J
>>> .
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users+unsubscribe@*
>>> *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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/X2Bd6g9yPPMJ.
>
> 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: Where I am wrong in loading static files ?

2012-06-22 Thread Melvyn Sopacua
On 22-6-2012 15:53, surya wrote:
> This is my project folder hierarchy:
> 
> project \
>project \ 
>   __init__.py
>   settings.py
>   urls.py
>   views.py
>   ... etc
>templates \
>css \
> index_css.css
> 
>media \ 
>  logo.png
> 
>templates \ 
>  home.html
>manage.py
> 
> 
> So, these are the settings I made in "settings.py"
> 
> currDir = os.path.dirname(__file__)
> templateDir_media = 
> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "media")
> templateDir_css = 
> os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "css")
> 
> STATICFILES_DIRS = (
> templateDir_media,
> templateDir_css,
> "d:/code/projects-dev/readdme/"
> )
> ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT
> 
> The HTML source file contains:
> 
> Image URL:  src="../media/logo.png"
> CSS URL : href="../css/twoColFixLtHdr.css"

You're not using staticfiles, because they will always result in
absolute path references. Try starting with the documentation and let us
know what you don't understand about it:
https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/

-- 
Melvyn Sopacua


-- 
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: Where I am wrong in loading static files ?

2012-06-22 Thread Surya Kasturi
Its not working.. I even tried with static links..

On Fri, Jun 22, 2012 at 9:37 PM, Kurtis Mullins wrote:

> For your URLs, use {{ STATIC_URL }}/css/index_css.css (or maybe {{
> STATIC_URL }}/app_name/css/index_css.css -- I've never tried this approach
> before)
>
>
> On Fri, Jun 22, 2012 at 11:55 AM, surya  wrote:
>
>> Well.. apart from that mistake..
>>
>> Is everything alright??
>>
>>
>> On Friday, June 22, 2012 8:37:55 PM UTC+5:30, Kurtis wrote:
>>>
>>> Here's a vaguely similar post: http://stackoverflow.**
>>> com/questions/6409920/django-**static-files-from-app-**directories
>>>
>>> Like one of the respondents recommended, try adding a "print
>>> str(STATICFILES_DIRS)" in your settings.py and then run "runserver" so you
>>> can see what actual directories are being included.
>>>
>>> On Fri, Jun 22, 2012 at 9:53 AM, surya  wrote:
>>>
 This is my project folder hierarchy:

 project \
project \
   __init__.py
   settings.py
   urls.py
   views.py
   ... etc
templates \
css \
 index_css.css

media \
  logo.png

templates \
  home.html
manage.py


 So, these are the settings I made in "settings.py"

  currDir = os.path.dirname(__file__)
 templateDir_media = os.path.join(os.path.join(os.**
 path.split(currDir)[0],"**Templates"), "media")
 templateDir_css = os.path.join(os.path.join(os.**
 path.split(currDir)[0],"**Templates"), "css")

  STATICFILES_DIRS = (
 templateDir_media,
 templateDir_css,
 "d:/code/projects-dev/readdme/**"
 )
 ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT

 The HTML source file contains:

 Image URL:  src="../media/logo.png"
 CSS URL : href="../css/twoColFixLtHdr.**css"


 So, when I am loading the page, I am unable to find the logo and CSS
  settings..

 Where I am going wrong and how should I fix it?




















  --
 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/-/**QKcKdIHVqY0J
 .
 To post to this group, send email to django-users@googlegroups.com.
 To unsubscribe from this group, send email to django-users+unsubscribe@
 **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 view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/X2Bd6g9yPPMJ.
>>
>> 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.
>

-- 
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: Where I am wrong in loading static files ?

2012-06-22 Thread Surya Kasturi
Okay.. I am on it.

On Fri, Jun 22, 2012 at 9:44 PM, Melvyn Sopacua wrote:

> On 22-6-2012 15:53, surya wrote:
> > This is my project folder hierarchy:
> >
> > project \
> >project \
> >   __init__.py
> >   settings.py
> >   urls.py
> >   views.py
> >   ... etc
> >templates \
> >css \
> > index_css.css
> >
> >media \
> >  logo.png
> >
> >templates \
> >  home.html
> >manage.py
> >
> >
> > So, these are the settings I made in "settings.py"
> >
> > currDir = os.path.dirname(__file__)
> > templateDir_media =
> > os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"),
> "media")
> > templateDir_css =
> > os.path.join(os.path.join(os.path.split(currDir)[0],"Templates"), "css")
> >
> > STATICFILES_DIRS = (
> > templateDir_media,
> > templateDir_css,
> > "d:/code/projects-dev/readdme/"
> > )
> > ## I JUST ADDED THOSE /MEDIA AND /CSS DIR IN IT
> >
> > The HTML source file contains:
> >
> > Image URL:  src="../media/logo.png"
> > CSS URL : href="../css/twoColFixLtHdr.css"
>
> You're not using staticfiles, because they will always result in
> absolute path references. Try starting with the documentation and let us
> know what you don't understand about it:
> https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/
>
> --
> Melvyn Sopacua
>
>
> --
> 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: Installing Django @ Shared Host

2012-06-22 Thread Segundo Acosta Delgado
De ninguna manera, lo mejor es que veas si el hosting soporta django, sino 
deberias cambiar de proveedor.

El jueves, 21 de junio de 2012 16:51:46 UTC-5, Miguel Guirao escribió:
>
> Hi all,
>
> I have a hosting service from ApolloHosting.com. I don't have SSH access 
> neither unsecure telnet to my account.
> I can FTP into my account. I have Python 2.5.
> I'm under Linux.
>
> Is there a way I could install django under these circunstances??
>
> Best Regards,
>
> Miguel Guirao
>

-- 
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/-/mYarjukSnqoJ.
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.



403 error with SAMEORIGIN in header

2012-06-22 Thread Mike
I developing a mac desktop app and I'm just making the first steps to add a 
feature that will connect to a Django server.  I have the Django project 
running on the development server and the app running on the same machine. 
 When I try to call a Django project view from the app, on 127.0.0.1:8000, 
Django replies with a 403 error and this header:

*"Content-Type" = "text/html";*

*Date = "Fri, 22 Jun 2012 16:43:27 GMT";*

*Server = "WSGIServer/0.1 Python/2.7.1";*

*"X-Frame-Options" = SAMEORIGIN;*

This seems to have something to do with clickjacking protection but I'm not 
doing anything with iframes.  Is there any other reason why Django would 
return this error?

-- 
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/-/t9io12nkG1YJ.
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: Installing Django @ Shared Host

2012-06-22 Thread Kurtis Mullins
I recommend building your application locally (on your own computer). You
can follow the tutorial and use Django's built in server for testing.

Once your application is ready to go live, then find a Django-Friendly
host. They're not too expensive.

I wouldn't recommend getting a django-friendly host before you build your
application because you may, or may not, decide that Django is right for
you.

Good luck!

On Thu, Jun 21, 2012 at 5:51 PM, Miguel Guirao  wrote:

> Hi all,
>
> I have a hosting service from ApolloHosting.com. I don't have SSH access
> neither unsecure telnet to my account.
> I can FTP into my account. I have Python 2.5.
> I'm under Linux.
>
> Is there a way I could install django under these circunstances??
>
> Best Regards,
>
> Miguel Guirao
>
> --
> 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/-/EyZwRUMFIy8J.
> 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: runserver cache my template files

2012-06-22 Thread Kurtis Mullins
Are you using a non-temorary caching mechanism like Memcache or DB Caching?
If so, do you have caching directives in your templates?

On Fri, Jun 22, 2012 at 3:21 AM, Tomás Garzón Hervás wrote:

> Yes, and I reload the browser with empty cache.
> thanks
>
>
> On Friday, June 22, 2012 9:02:23 AM UTC+2, bruno desthuilliers wrote:
>>
>> I assume you did check your browser cache ?
>
>  --
> 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/-/GE0EUGFeQKwJ.
>
> 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.



Internationalization Issues

2012-06-22 Thread Ricardo Jacas
Hi Everyone,
I'm having a lot of trouble with i18n. My templates don't display all the
translations (i've already checked for the "fuzzy" tag).
I have no idea what could it be, any thoughts? Anything may help, i've been
reading forums for hours.



-- 
lets reign all together

-- 
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.



Installing via Tutorial Part 2 / MacOSX / Can't create a superuser due to locale() problem.

2012-06-22 Thread Bill Torcaso

Hi,
I'm working through the tutorail.  Part 1 was fine, and part 2 shows me the 
site with the light blue background.  I proceed to make my first app, 
'djangotest'.

   1. I run django-admin.py and get a project
   2. I edit settings.py to select sqlite3, and put in an absolute path to 
   a sqlite db file.  I leave 'America/Chicago' unchanged.  the same error 
   happens if I change it to my timezone in EST.
   3. When I run syncdb, I get this error.  I look in the source and it has 
   something to do with 'locale' and a tuple of (None, None).  Please help.


[-] python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any 
superusers defined.
Would you like to create one now? (yes/no): yes
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 443, in execute_from_command_line
utility.execute()
  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 371, in handle
return self.handle_noargs(**options)
  File 
"/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py", 
line 110, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/Library/Python/2.7/site-packages/django/core/management/sql.py", 
line 189, in emit_post_sync_signal
interactive=interactive, db=db)
  File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", 
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File 
"/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py", 
line 73, in create_superuser
call_command("createsuperuser", interactive=True, database=db)
  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 150, in call_command
return klass.execute(*args, **defaults)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/Library/Python/2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
 
line 70, in handle
default_username = get_default_username()
  File 
"/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py", 
line 105, in get_default_username
default_username = get_system_username()
  File 
"/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py", 
line 85, in get_system_username
return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None


Thanks,

  --  Bill 

-- 
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/-/GmlYGnGfpfYJ.
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: Installing via Tutorial Part 2 / MacOSX / Can't create a superuser due to locale() problem.

2012-06-22 Thread Kurtis Mullins
Did you get an opportunity to type anything after "yes"? Or did it
just blow up at that point?

Based on the traceback, it looks like it is having trouble getting
your system's default username. I've never really noticed that it has
that functionality before but I wonder if there's something "weird"
about your System's configuration?

Which version of Django are you using?

To by-pass this (until you get the real problem worked out) give this a shot:

python manage.py shell # This will open up a terminal-shell in your
Django Environment
from django.contrib.auth.models import User # Import the User Model so
we can create a new user
user = User.objects.create_user(username='someusername',
password='somepassword', is_superuser=True) # Create the new User
(Remember these credentials)
user.save() # Save the User
exit() # Exit the Python Shell

And you should be all good to go.

On Fri, Jun 22, 2012 at 3:46 PM, Bill Torcaso  wrote:
>
>
> Hi,
> I'm working through the tutorail.  Part 1 was fine, and part 2 shows me the 
> site with the light blue background.  I proceed to make my first app, 
> 'djangotest'.
>
> I run django-admin.py and get a project
> I edit settings.py to select sqlite3, and put in an absolute path to a sqlite 
> db file.  I leave 'America/Chicago' unchanged.  the same error happens if I 
> change it to my timezone in EST.
> When I run syncdb, I get this error.  I look in the source and it has 
> something to do with 'locale' and a tuple of (None, None).  Please help.
>
>
> [-] python manage.py syncdb
> Creating tables ...
> Creating table auth_permission
> Creating table auth_group_permissions
> Creating table auth_group
> Creating table auth_user_user_permissions
> Creating table auth_user_groups
> Creating table auth_user
> Creating table django_content_type
> Creating table django_session
> Creating table django_site
>
> You just installed Django's auth system, which means you don't have any 
> superusers defined.
> Would you like to create one now? (yes/no): yes
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
>     execute_from_command_line(sys.argv)
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
> 443, in execute_from_command_line
>     utility.execute()
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
> 382, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 196, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 232, in execute
>     output = self.handle(*args, **options)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 371, in handle
>     return self.handle_noargs(**options)
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py",
>  line 110, in handle_noargs
>     emit_post_sync_signal(created_models, verbosity, interactive, db)
>   File "/Library/Python/2.7/site-packages/django/core/management/sql.py", 
> line 189, in emit_post_sync_signal
>     interactive=interactive, db=db)
>   File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", 
> line 172, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File 
> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>  line 73, in create_superuser
>     call_command("createsuperuser", interactive=True, database=db)
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
> 150, in call_command
>     return klass.execute(*args, **defaults)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 232, in execute
>     output = self.handle(*args, **options)
>   File 
> "/Library/Python/2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>  line 70, in handle
>     default_username = get_default_username()
>   File 
> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>  line 105, in get_default_username
>     default_username = get_system_username()
>   File 
> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>  line 85, in get_system_username
>     return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
>
>
> Thanks,
>
>   --  Bill
>
> --
> 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/-/GmlYGnGfpfYJ.
> 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?

Re: Installing via Tutorial Part 2 / MacOSX / Can't create a superuser due to locale() problem.

2012-06-22 Thread Kurtis Mullins
Oh man, it looks like my post got butchered. If you can't figure out
where each line ends, let me know!

On Fri, Jun 22, 2012 at 4:22 PM, Kurtis Mullins
 wrote:
> Did you get an opportunity to type anything after "yes"? Or did it
> just blow up at that point?
>
> Based on the traceback, it looks like it is having trouble getting
> your system's default username. I've never really noticed that it has
> that functionality before but I wonder if there's something "weird"
> about your System's configuration?
>
> Which version of Django are you using?
>
> To by-pass this (until you get the real problem worked out) give this a shot:
>
> python manage.py shell # This will open up a terminal-shell in your
> Django Environment
> from django.contrib.auth.models import User # Import the User Model so
> we can create a new user
> user = User.objects.create_user(username='someusername',
> password='somepassword', is_superuser=True) # Create the new User
> (Remember these credentials)
> user.save() # Save the User
> exit() # Exit the Python Shell
>
> And you should be all good to go.
>
> On Fri, Jun 22, 2012 at 3:46 PM, Bill Torcaso  wrote:
>>
>>
>> Hi,
>> I'm working through the tutorail.  Part 1 was fine, and part 2 shows me the 
>> site with the light blue background.  I proceed to make my first app, 
>> 'djangotest'.
>>
>> I run django-admin.py and get a project
>> I edit settings.py to select sqlite3, and put in an absolute path to a 
>> sqlite db file.  I leave 'America/Chicago' unchanged.  the same error 
>> happens if I change it to my timezone in EST.
>> When I run syncdb, I get this error.  I look in the source and it has 
>> something to do with 'locale' and a tuple of (None, None).  Please help.
>>
>>
>> [-] python manage.py syncdb
>> Creating tables ...
>> Creating table auth_permission
>> Creating table auth_group_permissions
>> Creating table auth_group
>> Creating table auth_user_user_permissions
>> Creating table auth_user_groups
>> Creating table auth_user
>> Creating table django_content_type
>> Creating table django_session
>> Creating table django_site
>>
>> You just installed Django's auth system, which means you don't have any 
>> superusers defined.
>> Would you like to create one now? (yes/no): yes
>> Traceback (most recent call last):
>>   File "manage.py", line 10, in 
>>     execute_from_command_line(sys.argv)
>>   File 
>> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
>> 443, in execute_from_command_line
>>     utility.execute()
>>   File 
>> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
>> 382, in execute
>>     self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
>> line 196, in run_from_argv
>>     self.execute(*args, **options.__dict__)
>>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
>> line 232, in execute
>>     output = self.handle(*args, **options)
>>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
>> line 371, in handle
>>     return self.handle_noargs(**options)
>>   File 
>> "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py",
>>  line 110, in handle_noargs
>>     emit_post_sync_signal(created_models, verbosity, interactive, db)
>>   File "/Library/Python/2.7/site-packages/django/core/management/sql.py", 
>> line 189, in emit_post_sync_signal
>>     interactive=interactive, db=db)
>>   File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", 
>> line 172, in send
>>     response = receiver(signal=self, sender=sender, **named)
>>   File 
>> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>>  line 73, in create_superuser
>>     call_command("createsuperuser", interactive=True, database=db)
>>   File 
>> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 
>> 150, in call_command
>>     return klass.execute(*args, **defaults)
>>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
>> line 232, in execute
>>     output = self.handle(*args, **options)
>>   File 
>> "/Library/Python/2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>>  line 70, in handle
>>     default_username = get_default_username()
>>   File 
>> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>>  line 105, in get_default_username
>>     default_username = get_system_username()
>>   File 
>> "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py",
>>  line 85, in get_system_username
>>     return getpass.getuser().decode(locale.getdefaultlocale()[1])
>> TypeError: decode() argument 1 must be string, not None
>>
>>
>> Thanks,
>>
>>   --  Bill
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://grou

Race and Locking? was Re: Duplicate rows with same key in DB?

2012-06-22 Thread ydjango

Thank you, I also believe it is Race condition. I do not want to use 
get_or_create as I like to have control over DB writes and updates. I will 
try Unique_together and catch the integrity error exception as Kurtis 
suggested or check again before doing save().

or just thinking aloud, Is there a way to acquire a lock which can 
serialize any other requests which have same "a" and "b" values?



On Friday, June 22, 2012 7:52:49 AM UTC-7, Daniel Roseman wrote:
>
> On Friday, 22 June 2012 06:23:32 UTC+1, ydjango wrote:
>>
>> I have code as
>>
>> view_a(request):
>>    Populate my_a, my_b and my_c...
>>   try:
>>   tp = TP.objects.get(a__exact = my_a, b__exact = my_b)
>>   except TP.DoesNotExist, e:
>>  tp = TP()
>>  tp.a = my_a
>>  tp.b = my_b
>>  tp.c = my_c
>>  tp.save()
>>   else:
>>  tp.c = my_c
>>  tp.save()
>>
>> This view is called by ajax calls. TP is a django model and mysql db. 
>> I am using django 1.1.4/ python2.5/mod_wsgi2.5,
>>
>> I find that in, one case, two rows with same value of  a and b has been 
>> created in DB. ( value of c was different)
>> What could have caused it? 
>>
>> Any clues or hints on how to track down this problem or what to look for 
>> will be appreciated.
>>
>>
> You probably have a race condition. You should use the built-in 
> `get_or_create` manager method, which helps to minimize that sort of thing 
> (it's not perfect, but it's better than coding it yourself).
> --
> 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/-/6XYOOu3cmIoJ.
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.



Send message to SMS Gateway

2012-06-22 Thread Setiaman
Hi,

I want to create a web app to send the message to SMS Gateway.
Try to google the suggested way is to use SMPP protocol.
But I can't find any easy package to send message thru SMPP.

Can any body give a pointer?


Rgrds,
Setiaman

-- 
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.