How to deploy a custom common module?
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Sat May 16 22:32:04 EDT 2015
On 17-5-2015 4:06, Jason Friedman wrote:
>> When I deploy test.py on another computer, I put (rsync) both test.py and cmn_funcs.py in the same remote directory.
>>
>> If I create another python project (test2.py) in new directory, that needs common functions, what should I do with cmn_funcs.py?
>
> I put my shared code in a separate folder, named something like
> /path/to/module_dir.
>
> I then add to /etc/profile.d/something.sh:
>
> export PYTHONPATH=$PYTHONPATH:/path/to/module_dir
>
I think you could use the user site packages directory as well for this... then you
should not have to change the PYTHONPATH.
https://docs.python.org/3.5/library/site.html#site.USER_SITE
(if you don't want to or cannot install into to the system's site-packages directory)
Irmen
More information about the Python-list
mailing list