It's a simple multilingual application boilerplate for developer who interested in Canjs and Python Flask combination. Flask part is inspired by Matt Wright's article.
When you develop new feature.
- pull develop branch
- make a new branch : git branch <name_of_new_feature_branch>
- develop and commit to new feature branch.
- make a test and do testing.
- If it works properly, review codes to avoid new bugs, merge to develop branch.
- remove new feature branch.
When you fix a critical problem.
- pull test branch
- make a new branch : git branch <name_of_hotfix_branch>
- develop and commit to new feature branch.
- make a test and do testing.
- If it works properly, review codes to avoid new bugs, merge to develop branch.
- Also, merge to test branch.
- remove hotfix branch.
- Don't use console.log();
- Use utils.log(Trace|Debug|Info|Warn|Json|Object|Error).
- Javascript log(utils.log(Trace|Debug|Info|Warn|Json|Object|Error)) should not contain '()' for optimize javascript.
- If you miss it, it will occur error in production environment.
- ex)utils.logDebug('initEdit', upload_image);
- wrong) utils.logDebug('initEdit', something_wrong());
- Flask/Canjs combination.
- Internationalization ready.
- Uesr CRUD implementation.
- User following/followers function implementation.
- Social connection implementation.
- others (TODO)
- RESTful API implementation.
- Responsive web design.
- Google's crawler friendly url('#!').
- Generate document easily.(Sphinx)
- Do testing easily. (nosetests)
- Cross Browser Compatibility (IE7, IE8, IE9, IE10, Firefox, Chrome, Opera..)
- Do you need more Features? Fork it and improve it! :D
- Canjs, Client-side JavaScript Framework.
- RequireJS, JavaScript file and module loader.
- RequireJS Optimizer, Optimization tool of RequireJS.
- Initializr, HTML5 templates generator.
- Bootstrap, Front-end framework.
- Bootstrap-ie7, Bootstrap 3 for IE7.
- mustache, Logic-less templates.
- i18next, JavaScript translating toolkit.
- Font Awesome, It gives you scalable vector icons that can instantly be customized.
- typeahead.js, It is a fast and fully-featured autocomplete library.
- spin.js, It dynamically creates spinning activity indicators that can be used as resolution-independent replacement for AJAX loading GIFs.
- Placeholders.js, It is a JavaScript polyfill for the HTML5 placeholder attribute.
- Jade(pyjade), High performance port of Jade-lang for python.
- jQuery, It is a fast, small, and feature-rich JavaScript library.
- jQuery BBQ, It leverages the HTML5 hashchange event to allow simple, yet powerful bookmarkable #hash history.
- Grunt, The JavaScript Task Runner.
- Can-Compile, Compiles CanJS EJS and Mustache views into a single JavaScript file.
- grunt-shell, A good way to interact with other CLI tools.
- grunt-contrib-watch, Run predefined tasks whenever watched file patterns are added, changed or deleted..
- grunt-uncss, A grunt task for removing unused CSS from your projects.
- time-grunt, Displays the execution time of grunt tasks.
- Flask, Microframework for Python based on Werkzeug, Jinja 2 and good intentions.
- Flask-Babel, Extension to Flask that adds i18n and l10n support to any Flask application.
- Flask-Gravatar, It's small and simple integration gravatar into flask.
- Flask-Security,It allows you to quickly add common security mechanisms to your Flask application.
- Flask-Social, Oauth provider login and APIs for use with Flask-Security.
- Flask-Assets, Flask-Assets helps you to integrate webassets into your Flask application.
- Flask-SQLAlchemy, Extension for Flask that adds support for SQLAlchemy.
- Flask-WTF, It offers simple integration with WTForms.
- Flask-Cache, It helps you to integrate cache into your Flask appication.
- Alembic, Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.
- Celery, Celery is an asynchronous task queue/job queue based on distributed message passing.
- Sphinx, Sphinx is a tool that makes it easy to create intelligent and beautiful documentation.
- JSDoc, An inline API documentation processor for JavaScript.
-
Install Docker.
-
Pull docker image from Docker Hub.
docker pull dorajistyle/flask-canjs-i18n-boilerplate
-
Run Docker image.
$ docker run -d -p 5544:5000 dorajistyle/flask-canjs-i18n-boilerplate
-
Enter 127.0.0.1:5544 into your web browser's addreess bar.
- virtualenv, It is a tool to create isolated Python environments.
- virtualenvwrapper, It' provides a set of commands which makes working with virtual environments much more pleasant.
$ git clone https://github.com/dorajistyle/flask-canjs-i18n-boilerplate.git
$ cd flask-canjs-i18n-boilerplate
$ mkvirtualenv flask-canjs-i18n-boilerplate
$ pip install -r requirements.txt
$ alembic revision --autogenerate -m "Alembic initilized boilerplate tables."
$ alembic upgrade head
You can login with '[email protected]' and 'password'.
$ python manage.py init_user
You should set values properly.(database, mail, social providers...)
- application/settings.py contain server side settings.
- application/frontend/static/js/settings.js contain client side settings.
- ./alembic.ini contain alembic settings.
- Server side translations(Babel) in applications/frontend/translations
- Client side translations(i18next) in applications/frontend/static/locales
$ python tr_compile.py
$ python wsgi.py
$ python generate_documents.py
You should install Nodejs and RequireJS. If you want detail document, Click RequireJS Optimizer.
$ optimize_static.sh
$ python update_platform.py
$ python generate_documents.py
$ python run_nosetests.py
$ python refresh_database.py
You should install nodeJS npm and grunt first.
$ npm install -g grunt-cli
And then you should install npm modules into ./application/frontend/views
$ npm install can-compile --save-dev
$ npm install grunt-shell --save-dev
$ npm install grunt-contrib-watch --save-dev
$ npm install time-grunt --save-dev
Or just run script below.
$ python install_node_modules.py
And finally run below.
$ python refresh_static.py
If you want to watch mustache files and refresh views automatically, run below.
$ python watch_static.py
Flask-canjs-i18n-boilerplate is under the MIT license.