Giter VIP home page Giter VIP logo

2020_cropconnect's Introduction

README - 2020_cropconnect

Local testing

on Windows:

  1. install Python (3.8.x)
  2. open Powershell in project folder
  3. virtualenv and activate it
  4. run app from Powershell:
pip install -r requirements.txt
set FLASK-APP=main.py
flask run

Multilanguage Support

Note: below commands should be executed in a terminal opened in the project root folder (i.e. where main.py is) Important: Activate the virtualenv you use for the project first!

Initialization

Using flask-babel: First get all the strings that need to be translated (marked using {{ _("Texte") }} in templates and python code)

pybabel extract -F babel.cfg -k _l -o messages.pot .

this file "messages.pot" does not need to be included in the repo! It is just an intermediate result

Now generate translations for each supported language (de, it, fr)

/!\ this command overwrites your old translations! I.e. make sure you have saved them elsewhere if you want to reuse.

pybabel init -i messages.pot -d app/translations -l de
pybabel init -i messages.pot -d app/translations -l fr
pybabel init -i messages.pot -d app/translations -l it

once you made the translations in the .po files, compile to usable files (.mo):

pybabel compile -d app/translations compiling catalog app/translations/de/LC_MESSAGES/messages.po to app/translations/de/LC_MESSAGES/messages.mo
pybabel compile -d app/translations compiling catalog app/translations/it/LC_MESSAGES/messages.po to app/translations/it/LC_MESSAGES/messages.mo
pybabel compile -d app/translations compiling catalog app/translations/fr/LC_MESSAGES/messages.po to app/translations/fr/LC_MESSAGES/messages.mo

Update Translatons

to update the .po files (i.e. if you want to keep your previous work), use the following commands to update

pybabel extract -F babel.cfg -k _l -o messages.pot .
pybabel update -i messages.pot -d app/translations

do your translation work and then update the .mo files just like before:

pybabel compile -d app/translations compiling catalog app/translations/de/LC_MESSAGES/messages.po to app/translations/de/LC_MESSAGES/messages.mo
pybabel compile -d app/translations compiling catalog app/translations/it/LC_MESSAGES/messages.po to app/translations/it/LC_MESSAGES/messages.mo
pybabel compile -d app/translations compiling catalog app/translations/fr/LC_MESSAGES/messages.po to app/translations/fr/LC_MESSAGES/messages.mo

Deployment

Works on version 2.7.

Check if folder get the rights :


If small changes :

git pull

git branch (list branches)

git checkout branch (to change branch)

If java script or db changes :

rm -rv (no -f)

git clone https://github.com/ixvw/2020_cropconnect .

scp .\credentials.py [email protected]

  • adding resources/ and db/ folders

  • RW for resources/ and db/

Logs requests: /etc/httpd/logs/access_log_cropconnect

Errors: /etc/httpd/logs/error_log_cropconnect

Tools

reload : cropconnect.ch/reboot_python

admin back office : cropconnect.ch/admin

Who do I talk to?

  • Martin Baldinger (development) (martin.baldinger[@]gmail.com)
  • Nicolas Peslerbe (deployment) (nicolas[@]peslerbe.com)
  • Maxime Marchionno (maxime.marchionno[@]protonmail.com)

2020_cropconnect's People

Contributors

martinbaldinger-ekz avatar ixvw avatar nicolasp9-dev avatar invveritas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.