---
# System prepended metadata

title: Flask scheduler

---

---
title: Flask scheduler
tag: ftw yosemite
---
Flask cont
===

## Flask - scheduler
### Install
```
pip install flask-scheduler
```

### Example
```python
from flask_apscheduler import APScheduler

############## FLASK APSCHEDULER ###########
# create apscheduler object
scheduler = APScheduler()
# Config our app to work with scheduler
scheduler.init_app(app)
# Start scheduler
scheduler.start()
############## FLASK APSCHEDULER END #######

############## DEFINE TASK #################
@scheduler.task("interval", id='job_1', seconds=10)
def simple_function():
    print("Hello World!!!")
############################################
```

### Forget passwordf
1. Ability to send email to user
emailgun

### Deploy
```python
sudo 
heroku init
heroku create <app_name>
[Copy heroku git link]

cd <Your project folder>
git init
git remote add heroku <heroku_git_link>
git add ./
git commit -m "First init"
git push heroku master

# activate vevn
source venv/bin/activate

# install gunicorn
pip install gunicorn
# Create requirement file
pip freeze > requirements.txt

# Create Procfile


```