Re: Importing modules in code

2011-02-17 Thread Kenneth Gonsalves
On Thu, 2011-02-17 at 02:44 -0800, Daniel Roseman wrote: > > could you elaborate on this? I am suffering from this misconception. > > > Not sure what else to say. Taking mod_wsgi as an example, Apache > spawns a > number of processes and/or threads to serve Django requests, depending > on > your

Re: Importing modules in code

2011-02-17 Thread Daniel Roseman
On Thursday, February 17, 2011 6:37:56 AM UTC, lawgon wrote: > > On Wed, 2011-02-16 at 02:12 -0800, Daniel Roseman wrote: > > Your question betrays a misconception that I often see. Django - at > > least > > when served other than via CGI - does not reload everything for each > > request. The Dja

Re: Importing modules in code

2011-02-16 Thread Kenneth Gonsalves
On Wed, 2011-02-16 at 02:12 -0800, Daniel Roseman wrote: > Your question betrays a misconception that I often see. Django - at > least > when served other than via CGI - does not reload everything for each > request. The Django process is long-running, and is managed by the > server, > but usual

Re: Importing modules in code

2011-02-16 Thread Aryeh Leib Taurog
On Feb 16, 12:21 pm, galago wrote: > My django runs on FastCGI as I can see. > I have that small part of the code: > > # Generate user register_hash >                 import hashlib >                 reg_hash = hashlib.md5() >                 reg_hash.update(request.POST.get('email') + > str(rando

Re: Importing modules in code

2011-02-16 Thread galago
My django runs on FastCGI as I can see. I have that small part of the code: # Generate user register_hash import hashlib reg_hash = hashlib.md5() reg_hash.update(request.POST.get('email') + str(random.random()) + request.POST.get('username'))

Re: Importing modules in code

2011-02-16 Thread Daniel Roseman
On Wednesday, February 16, 2011 8:38:40 AM UTC, galago wrote: > > Is it a good idea to import modules in the middle of the code, and not on > the beginning? > I want to make a hash generation. It's few lines - it's used once in all > application. Should I import hashlib just on the beginning of t

RE: Importing modules in code

2011-02-16 Thread Chris Matthews
. django modules 3. 3rd party modules 4. Your project/application modules Regards Chris From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of galago Sent: 16 February 2011 10:39 To: django-users@googlegroups.com Subject: Importing modules in

Importing modules in code

2011-02-16 Thread galago
Is it a good idea to import modules in the middle of the code, and not on the beginning? I want to make a hash generation. It's few lines - it's used once in all application. Should I import hashlib just on the beginning of the file? Now I put it with the rest of the code. Is it bad? I don't wa

Re: importing modules

2005-08-24 Thread [EMAIL PROTECTED]
Another possibility would be to simply encourage the placing of the 'project.apps' directory in the PYTHONPATH as well as the parent directory of 'project'. If this was the convention, then people could simply simply use the form: myproject.models.modulename myproject.utils.anothermodule etc. T

Re: importing modules

2005-08-24 Thread [EMAIL PROTECTED]
In briefly playing around, I couldn't figure out a way to use the INSTALLED_APPS tuple to extend the module path. I just don't have that sort of kung-fu with python and manipulating modules. The one thing I came up with instead is creating a new SETTING called "EXTENSION_APPS_DIR". This would be

Re: importing modules

2005-08-24 Thread [EMAIL PROTECTED]
So, to add an app to a new project, you just need to include it in the INSTALLED_APPS tuple as "ellington.apps.your_app_name"? This works for me, but I am concerned about easily sharing applications with other people and being able to do imports within my application. My one suggestion is to use

Re: importing modules

2005-08-24 Thread Adrian Holovaty
On 8/24/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Because of this, "project.apps.application.module" should work and it > does for me. But, this isn't ideal since I do want there to be a > dependency on the project name in my apps that I want to be able to > share and drag-and-drop into m

Re: importing modules

2005-08-24 Thread [EMAIL PROTECTED]
Is this by default? I don't have the 'apps' module from my project available to me in my View. According to the instructions on the django website, it is the "parent" directory of your project that you should include in the path, not the project directory itself. Because of this, "project.apps.ap

Re: importing modules

2005-08-23 Thread rb
Figured out my own problem: the I kept trying to import "project.apps.application.module" when the django configuration means that my sys.path is actually already in the project directory. Importing "apps.application.module" works fine.

importing modules

2005-08-22 Thread rb
Hello, I'm having a strange issue with importing my own modules into the view module for an application. What I have is this: project/apps/application/module.py project/apps/application/views/application.py In application.py, I want to include module.py, but no matter which way I try the impor