On Mon, Mar 11, 2013 at 1:05 PM, Bill Freeman <[email protected]> wrote:
> I wouldn't call that "compiling", but it is a step that many people take in
> order to make it slightly more convenient to run.
>
> While "compiling" does happen, it is done automatically as a side effect of
> running the program.
>
> You are apparently not on Windows, since you have a chmod command.
>
> You can always run the program using:
>
>    python filename.py
>
> As the python interpreter reads filename.py, it is "compiled" into "byte
> codes" which is actually what the python interpreter interprets.

I'd call it compiling, since python itself does!

Python ships with a module called 'compileall' to recursively compile
all python files within a directory tree. Use it like this:

python -m compileall /path/to/directory

http://docs.python.org/2/library/compileall.html

You can use this to ensure that your pyc files are fresh and
pre-compiled before deployment. I normally update files, remove all
.pyc/.pyo files, then run compileall as part of a deployment. Removing
pyc files may be necessary if you have removed a module, you do not
want old stale pyc files.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to