Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python and App Engine project structure

I am relatively new to python and app engine, and I just finished my first project. It consists of several *.py files (usually py file for every page on the site) and respectively temple files for each py file. In addition, I have one big PY file that has many functions that are common to a lot of pages, in I also declared the classes of db.Model (that is the datastore kinds).

My question is what is the convention (if there is one) of arranging these files. If I create a model.py with the datastore classes, should it be in different package? Where should I put my template files and all of the py files that handle every page (should they be in the same directory as the one big common PY file)?

I have tried to look for MVC and such implementations online but there are very few.

Thanks,

Joel

like image 430
Joel Avatar asked Mar 30 '10 14:03

Joel


1 Answers

I usually organize my projects in this way:

project 
  main.py
  README
  models
      bar.py
      foo.py
  views
      foolist.hml
      barlist.hml
  controllers
      controller1.py
      controller2.py
  api
      controllerapi.py
  helpers
      utilities.py
  lib
      extfoo.py
  db
     foo.db
  test
     test.py

Look at this post; it's a really great article on how to structure a project (not in python but it does not matter).

like image 170
systempuntoout Avatar answered Oct 04 '22 21:10

systempuntoout