I'm currently developing a Python project which is growing and I may implement it as a webapp in GAE in the future.
As the project is growing I'm pruning potentially reusable code into separate packages & modules, which at present are on my PYTHONPATH.
Do you have any advice on how to structure my project, and reusable packages so that it will fit nicely into a GAE project in the future?
Looking at recommendations on GAE project structure in other posts (such as this and this and this) seem fairly flat - is that the best way to go?
What about 3rd party packages/modules? Is it best to bite the bullet and use VirtualEnv from the beginning?
Thanks very much. Prembo.
Just put your various libraries in packages off the root directory of your app. The root directory is automatically added to your app's sys.path
.
If you wish you can put them in a lib
directory off the root, you can do so, but you'll have to write a module that adds that directory to the end of sys.path
, and import it before you import anything from lib
.
Using virtualenv is an option, but I personally don't think it gains you much, since you can't run a virtualenv in production, and the dev_appserver
emulates the production environment.
I can't tell you about GAE in particular, but I can tell you that biting the bullet has nothing to do with it - using VirtualEnv (and virtualenvwrapper) will make your Python development smoother, simpler, and easier all around.
The over head is low, the benefits are many.
Switch. Now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With