Git Product home page Git Product logo

microblog's Introduction

  • Flask Microblog source venv/bin/activate flask run FLASK_APP=microblog.py

Tips flask db migrate -m "new fields in user model" flask db upgrade

setup fake email server in debug

MAIL_SERVER=localhost MAIL_PORT=8025

MAIL_SERVER=smtp.googlemail.com MAIL_PORT=587 MAIL_USE_TLS=1 MAIL_USERNAME= MAIL_PASSWORD=

python -m smtpd -n -c DebuggingServer localhost:8025

sending mail

from flask_mail import Message from app import mail msg = Message('test subject', sender=app.config['ADMINS'][0],recipients=['[email protected]']) msg.body = 'text body' msg.html = '

HTML body

' mail.send(msg)

generate requirements.txt

pip freeze > requirements.txt pip freeze > requirements-dev.txt

generate .pot files

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

#generate lanague catalog pybabel init -i messages.pot -d app/translations -l es

#translate flask translate init flask translate update flask translate compile

elastic search

from elasticsearch import Elasticsearch es = Elasticsearch('http://localhost:9200') es.index(index='my_index', doc_type='my_index', id=1, body={'text': 'this is a test'}) {u'_type': u'my_index', u'_seq_no': 0, u'_shards': {u'successful': 1, u'failed': 0, u'total': 2}, u'_index': u'my_index', u'_version': 1, u'_primary_term': 1, u'result': u'created', u'_id': u'1'} es.index(index='my_index', doc_type='my_index', id=2, body={'text': 'a second test'}) {u'_type': u'my_index', u'_seq_no': 0, u'_shards': {u'successful': 1, u'failed': 0, u'total': 2}, u'_index': u'my_index', u'_version': 1, u'_primary_term': 1, u'result': u'created', u'_id': u'2'} es.search(index='my_index', doc_type='my_index', body={'query': {'match': {'text': 'this test'}}}) {u'hits': {u'hits': [{u'_score': 0.5753642, u'_type': u'my_index', u'_id': u'1', u'_source': {u'text': u'this is a test'}, u'_index': u'my_index'}, {u'_score': 0.2876821, u'_type': u'my_index', u'_id': u'2', u'_source': {u'text': u'a second test'}, u'_index': u'my_index'}], u'total': 2, u'max_score': 0.5753642}, u'_shards': {u'successful': 5, u'failed': 0, u'skipped': 0, u'total': 5}, u'took': 6, u'timed_out': False} es.search() es.indices.delete('my_index')

(venv) $ git pull # download the new version (venv) $ sudo supervisorctl stop microblog # stop the current server (venv) $ flask db upgrade # upgrade the database (venv) $ flask translate compile # upgrade the translations (venv) $ sudo supervisorctl start microblog # start a new server

microblog's People

Contributors

miamiruby avatar

Watchers

 avatar  avatar

Forkers

iamjonbradley

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.