Re: why my django site doesn't create .pyc file?

2008-06-09 Thread Jeff Anderson
Scott Moonen wrote:
>> I think this way, apache could be a little more faster. Am I right?
>>
>> 
>
> I don't think it will be faster.  Django normally runs as a long-standing
> process (either inside Apache or as a standalone process, depending on the
> deployment model you've chosen).  So, unlike ordinary CGI scripts, your
> Python bytecode will not need to be generated except for the very first time
> that your code is loaded.  Once it's up and running it will already be in
> memory so it won't need to be reinterpreted.
>   
When I first noticed that mod_python didn't seem to spit out .pyc files,
I figured that this was a "feature" because of its one-time loading
nature. I kind of liked the concept because .pyc files seem like clutter
sometimes. Good to know that my assumption was wrong. I'm going to keep
my permissions the way that they are. :)



signature.asc
Description: OpenPGP digital signature


Re: why my django site doesn't create .pyc file?

2008-06-09 Thread pength

Tim and Scott, thank you very much!

On Jun 9, 10:03 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> >> I think this way, apache could be a little more faster. Am I
> >> right?
>
> > I don't think it will be faster.  Django normally runs as a
> > long-standing process (either inside Apache or as a standalone
> > process, depending on the deployment model you've chosen).
> > So, unlike ordinary CGI scripts, your Python bytecode will not
> > need to be generated except for the very first time that your
> > code is loaded.  Once it's up and running it will already be
> > in memory so it won't need to be reinterpreted.
>
> If you want, you can pre-compile everything as described at
>
>http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm
>
> which shows you can issue
>
>bash$ cd ~/code
>bash$ python -m compileall .
>[output]
>
> which will compile each .py file into a corresponding .pycfile
> within the current directory and subdirectories.  I believe the
> Debian variants (others may as well) do this in the system
> directories upon installation so users don't have to recompile
> all the system libraries.
>
> The time saved is minimal, but there's no harm in preemptively
> compiling your files.
>
> -tim
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why my django site doesn't create .pyc file?

2008-06-09 Thread Tim Chase

>> I think this way, apache could be a little more faster. Am I
>> right?
> 
> I don't think it will be faster.  Django normally runs as a
> long-standing process (either inside Apache or as a standalone
> process, depending on the deployment model you've chosen).
> So, unlike ordinary CGI scripts, your Python bytecode will not
> need to be generated except for the very first time that your
> code is loaded.  Once it's up and running it will already be
> in memory so it won't need to be reinterpreted.

If you want, you can pre-compile everything as described at

   http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm

which shows you can issue

   bash$ cd ~/code
   bash$ python -m compileall .
   [output]

which will compile each .py file into a corresponding .pyc file 
within the current directory and subdirectories.  I believe the 
Debian variants (others may as well) do this in the system 
directories upon installation so users don't have to recompile 
all the system libraries.

The time saved is minimal, but there's no harm in preemptively 
compiling your files.

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why my django site doesn't create .pyc file?

2008-06-09 Thread Scott Moonen
>
> I think this way, apache could be a little more faster. Am I right?
>

I don't think it will be faster.  Django normally runs as a long-standing
process (either inside Apache or as a standalone process, depending on the
deployment model you've chosen).  So, unlike ordinary CGI scripts, your
Python bytecode will not need to be generated except for the very first time
that your code is loaded.  Once it's up and running it will already be in
memory so it won't need to be reinterpreted.

I personally don't think the trade-off is worth it here.  You're giving
Apache write access to your source code (which may not be much of a security
risk relative to other things like the fact that Apache has access to your
database, but it is definitely a blurring of privilege boundaries), and
you're not getting any long-running performance benefit from it; only a
slight initial load benefit.


  -- Scott

On Mon, Jun 9, 2008 at 9:40 AM, pength <[EMAIL PROTECTED]> wrote:

>
> Thanks a lot !
>
> I changed the user information in apache2's conf file, and now it's
> OK!
>
> I think this way, apache could be a little more faster. Am I right?
>
> On 6月9日, 下午7时39分, "Valts Mazurs" <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > Check if web server process has enough privileges to write in the
> > directories containing .py files.
> >
> > Regards,
> > Valts.
> >
> > On Mon, Jun 9, 2008 at 1:25 PM, pength <[EMAIL PROTECTED]> wrote:
> >
> > > I have justed built my site on slicehost. Alhough my site is running
> > > properly, I found if I update any  file (.py file, of course), it
> > > never recreate the .pyc file. Actually, if I delete any .pyc file,
> > > then it will never appear.
> >
> > > I think there's something wrong with my site config, can anyone give
> > > me any hint?
> >
> > > I am using nginx as front proxy server and static file server, apache2
> > > and mod_python as backend.
> >
> > > Thanks!
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why my django site doesn't create .pyc file?

2008-06-09 Thread pength

Thanks a lot !

I changed the user information in apache2's conf file, and now it's
OK!

I think this way, apache could be a little more faster. Am I right?

On 6月9日, 下午7时39分, "Valts Mazurs" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Check if web server process has enough privileges to write in the
> directories containing .py files.
>
> Regards,
> Valts.
>
> On Mon, Jun 9, 2008 at 1:25 PM, pength <[EMAIL PROTECTED]> wrote:
>
> > I have justed built my site on slicehost. Alhough my site is running
> > properly, I found if I update any  file (.py file, of course), it
> > never recreate the .pyc file. Actually, if I delete any .pyc file,
> > then it will never appear.
>
> > I think there's something wrong with my site config, can anyone give
> > me any hint?
>
> > I am using nginx as front proxy server and static file server, apache2
> > and mod_python as backend.
>
> > Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why my django site doesn't create .pyc file?

2008-06-09 Thread Valts Mazurs
Hello,

Check if web server process has enough privileges to write in the
directories containing .py files.

Regards,
Valts.

On Mon, Jun 9, 2008 at 1:25 PM, pength <[EMAIL PROTECTED]> wrote:

>
> I have justed built my site on slicehost. Alhough my site is running
> properly, I found if I update any  file (.py file, of course), it
> never recreate the .pyc file. Actually, if I delete any .pyc file,
> then it will never appear.
>
> I think there's something wrong with my site config, can anyone give
> me any hint?
>
> I am using nginx as front proxy server and static file server, apache2
> and mod_python as backend.
>
> Thanks!
> >
>

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



why my django site doesn't create .pyc file?

2008-06-09 Thread pength

I have justed built my site on slicehost. Alhough my site is running
properly, I found if I update any  file (.py file, of course), it
never recreate the .pyc file. Actually, if I delete any .pyc file,
then it will never appear.

I think there's something wrong with my site config, can anyone give
me any hint?

I am using nginx as front proxy server and static file server, apache2
and mod_python as backend.

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