Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from queue_app import app
- if __name__ == '__main__':
- app.run(debug=True)
- from flask import Flask, render_template
- from apscheduler.schedulers.background import BackgroundScheduler
- from queue_app.updater import update_printer
- app = Flask(__name__)
- app.config.from_object('config')
- @app.before_first_request
- def init():
- sched = BackgroundScheduler()
- sched.start()
- sched.add_job(update_printer, 'interval', seconds=10)
- @app.route('/')
- def index():
- return render_template('index.html')
- import paramiko
- import json
- from queue_app import app
- def update_printer():
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(app.config['SSH_SERVER'], username = app.config['SSH_USERNAME'], password = app.config['SSH_PASSWORD'])
- ...
- queue/
- app.py
- config.py
- queue_app/
- __init__.py
- updater.py
- Traceback (most recent call last):
- File "app.py", line 1, in <module>
- from queue_app import app
- File "/Users/name/queue/queue_app/__init__.py", line 3, in <module>
- from queue_app.updater import update_printer
- File "/Users/name/queue/queue_app/updater.py", line 3, in <module>
- from queue_app import app
- ImportError: cannot import name 'app'
- from .queue_app import app
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement