librelist archives

« back to archive

How To Structure Large Falcon Applications?

How To Structure Large Falcon Applications?

From:
Sumej
Date:
2015-02-26 @ 11:16
Hello, I haven't find how to organize Falcon to great application: 
I have read "How To Structure Large Flask Applications" 
https://www.digitalocean.com/community/tutorials/how-to-structure-large-flask-applications
, but I am noob to do same for Falcon. I want write example if someone 
will help me. 

Regards 

Re: [falcon] How To Structure Large Falcon Applications?

From:
Oscar Carballal
Date:
2015-02-26 @ 11:36
It depends on your own style... in my case I split it pretty close to a
django layout:

I create a main directory, and inside it I create the virtual enviroment
directory and a clone of the repository.

Within the project itself, I split everything into resources, models,
database related code, utilities and settings

The resulting tree is something like this:

Main Directory
  |
  |- logs
  |    |- nginx
  |    |- uwsgi
  |
  |- virtualenv
  |
  |- project
       |
       |- resources
       |    |- auth
       |    |    |- basicauth.py
       |    |    |- oauth.py
       |    |
       |    |- resource1.py
       |    |- resource2.py
       |
       |- models
       |    |- model1.py
       |    |- model2.py
       |
       |- db
       |    |- connectors.py
       |
       |- middleware
       |    |- middleware1.py
       |
       |- utils
       |    |- utils1.py
       |
       |- settings
       |    |- development.py
       |    |- staging.py
       |    |- production.py
       |
       |- requirements (dynamic pip requirements)
       |    |- common.txt
       |    |- dev.txt
       |    |- production.txt
       |
       |- app.py
       |- routes.py

On app.py I add both commands that I would like to run (usually syncdb,
generate a test database, create an admin user) adn the application itself.
My main project is organized like that: https://github.com/clione/sikre

I hope this is useful to you. I guess I can make a structure cookbook for
falcon when I have some spare time...










Regards,
Oscar

--
Oscar Carballal Prego - Senior Software Developer
http://oscarcp.com | @pizte

On 26 February 2015 at 11:16, Sumej <valeranew@ukr.net> wrote:

> Hello,
> I haven't find how to organize Falcon to great application:
>
> I have read "How To Structure Large Flask Applications"
> 
https://www.digitalocean.com/community/tutorials/how-to-structure-large-flask-applications
> , but I am noob to do same for Falcon.
> I want write example if someone will help me.
>
>
> Regards
>