views:

45

answers:

1

I plan to organize my python project the following way:

<my_project>/
         webapp/
           mymodulea.py
           mymoduleb.py
           mymodulec.py
           mylargemodule/
                 __init.py__
                 mysubmodule1.py
                 mysubmodule2.py
         backend/
           mybackend1.py
           mybackend2.py
         lib/
            python_external_lib1.py
            python_external_large_lib2/
                    __init__.py
                    blabla.py
            python_external_lib2.py

in my development IDE (PYdev) to have all working I have setup webapp/, backend/ and lib/ as source folders and all of course works.

How can I deploy it on a remote server? Have I to set PYTHONPATH in a startupscript ?Or have I to it programmatively?

+1  A: 

If you are treating webapp, backend, and lib as source folders, then you are importing (for example) mymodulea, mybackend1, and python_external_large_lib2.

Then on the server, you must put webapp, backend, and lib into your python path. Doing it in some kind of startup script is the usual way to do it. Doing it programmatically is complicated because now your code needs to know what environment it's running in to configure the path correctly.

Ned Batchelder