Advertisement
Guest User

Untitled

a guest
Mar 10th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. from queue_app import app
  2.  
  3. if __name__ == '__main__':
  4. app.run(debug=True)
  5.  
  6. from flask import Flask, render_template
  7. from apscheduler.schedulers.background import BackgroundScheduler
  8. from queue_app.updater import update_printer
  9. app = Flask(__name__)
  10. app.config.from_object('config')
  11.  
  12. @app.before_first_request
  13. def init():
  14. sched = BackgroundScheduler()
  15. sched.start()
  16. sched.add_job(update_printer, 'interval', seconds=10)
  17.  
  18. @app.route('/')
  19. def index():
  20. return render_template('index.html')
  21.  
  22. import paramiko
  23. import json
  24. from queue_app import app
  25.  
  26. def update_printer():
  27. ssh = paramiko.SSHClient()
  28. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  29. ssh.connect(app.config['SSH_SERVER'], username = app.config['SSH_USERNAME'], password = app.config['SSH_PASSWORD'])
  30.  
  31. ...
  32.  
  33. queue/
  34. app.py
  35. config.py
  36. queue_app/
  37. __init__.py
  38. updater.py
  39.  
  40. Traceback (most recent call last):
  41. File "app.py", line 1, in <module>
  42. from queue_app import app
  43. File "/Users/name/queue/queue_app/__init__.py", line 3, in <module>
  44. from queue_app.updater import update_printer
  45. File "/Users/name/queue/queue_app/updater.py", line 3, in <module>
  46. from queue_app import app
  47. ImportError: cannot import name 'app'
  48.  
  49. from .queue_app import app
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement