Skip to content

Structure of Project

Tushar Gautam edited this page Jun 1, 2021 · 1 revision

Structure of project (Subject to change)

└───python-on-pails # Files you see in mvc folder are for testing and will be removed later
    │   .gitignore
    │   main.py # entry point of project, ideally you will not have to change anything here
    │   README.md
    │
    ├───mvc # This time we are trying to follow MVC as much as we can
    │   ├───controllers # If your web app is a car, then this is the engine, use it to define your APIs
    │   │   │   routes.py # two separate dictionaries for GET and POST routes
    │   │   │
    │   │   └───services # we encourage using services folder for python files that you add to keep structure nice and clean
    │   │           greet.py # temporary file for testing
    │   │
    │   ├───models # use this folder to define your data models and types, you can later use these to automatically type cast JSON to these
    │   │       inputModels.py # temporary file for testing
    │   │
    │   └───views # Folder for your views
    │       │   views.py # define your view routes in this dictionary
    │       │
    │       └───static # every thing present in this folder is public
    │               index.py # output of python files will be served as html
    │               inline.pyhtml # output of html with processed inline python will be served as html
    │               welcome.html # files be served with there suitable MIME type according to there extensions
    │
    ├───server # BTS of server, our aim is to make sure you spend least time tinkering it
    │       helper.py # functions to import request data and other things in python files
    │       internalModels.py # contains internal models like 'PyopReq' that can be used to customize behaviour
    │       mimeTypes.py # dictionary mapping extensions to MIME types
    │       misc.py # this is where functions for parsing and type casting are present
    │       responseHandler.py # executes/reads files
    │       settings.py # change values of some variables here to modify server according to your need
    │
    └───tests # this is where test cases are present
            test_pyop_server.py # currently tests automatic type casting
Clone this wiki locally