里面的第7章大型程序的结构,在pycharm里面建立了名为flasky的程序,结果运行的时候报错,请教是什么问题?
不好意思已经完成
from: can't read /var/mail/app
错误内容如下:
./manage.py: line 2: import: command not found
from: can't read /var/mail/app
from: can't read /var/mail/app.models
from: can't read /var/mail/flask.ext.script
from: can't read /var/mail/flask.ext.migrate
./manage.py: line 9: syntax error near unexpected token `('
./manage.py: line 9: `app = create_app(os.getenv('FLASKY_CONFIG') or 'default')'
附录manage.py的代码如下:
import os
from app import create_app, db
from app.models import User, Role
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASKY_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app)
def make_shell_context():
return dict(app=app, db=db, User=User, Role=Role)
manager.add_command("shell", Shell(make_context=make_shell_context()))
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
各位我已经解决了这个问题了,谢谢