Proper way to run a PyCharm project
Question: This is a seemingly simple problem but it proves to be harder than expected.

I've created a project in pycharm in the following layout

    
    
    bin
        main
    helpers
        userhelper
    models
        user
        session
    tests
        userTest
    

in my main I run the code that calls everything and this works like a charm in
pycharm. Now I want to run this on a server and start it with cron. How do I
start this from cron while keeping all the module references in place?

I guess I need to add the root of my project to the python path. To do this I
added the following bash script to invoke my project with:

    
    
    PYTHONPATH="${PYTHONPATH}:/home/steven/projectX"
    export PYTHONPATH
    python bin/main.py
    

But this does not seem to do anything, what would be the best way to
periodically run the bin/main.py within this project and have all my modules
and things like
'ConfigParser.RawConfigParser().read(os.path.abspath("../configuration.cfg"))'
in place relative to my project?

EDIT: I am not trying to fix my imports or debugging my code, I have a large
project in pycharm that runs a simulation that I want to invoke on the server
an maintain within my development setup. The question is how do I run this in
the same way pycharm does?


Answer: It sounds like you're interested in making a distributable Python package. You
should read through the tutorial [here](https://python-packaging-user-
guide.readthedocs.org/en/latest/distributing/). Ultimately, you're going to
want to write a setup.py (sure you could call it something else, but it's like
renaming `self` \-- why do it?) that will configure your project. Now a word
of advice since I've seen many people go down a wrong path here. You NEVER
want to modify your PYTHONPATH directly. It might be the quickest solution to
get something up and working, but it WILL cause lasting problems.

