weijiang1994 / Blogin

A blog system depend on flask.使用flask框架开发的个人博客系统.
https://2dogz.cn
GNU General Public License v3.0
509 stars 99 forks source link

No file blogin.log #3

Closed SuperTyrael closed 3 years ago

SuperTyrael commented 3 years ago
  File "/Users/liam/Desktop/Git/Blogin/env/bin/flask", line 10, in <module>
    sys.exit(main())
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 967, in main
    cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/click/core.py", line 1254, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/click/core.py", line 1297, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 542, in get_command
    rv = info.load_app().cli.get_command(ctx, name)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 388, in load_app
    app = locate_app(self, import_name, name)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 257, in locate_app
    return find_best_app(script_info, module)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 83, in find_best_app
    app = call_factory(script_info, app_factory)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask/cli.py", line 119, in call_factory
    return app_factory()
  File "/Users/liam/Desktop/Git/Blogin/blogin/__init__.py", line 55, in create_app
    register_log(app)
  File "/Users/liam/Desktop/Git/Blogin/blogin/__init__.py", line 238, in register_log
    file_handler = RotatingFileHandler('logs/blogin.log', maxBytes=10 * 1024 * 1024, backupCount=10)
  File "/Users/liam/opt/anaconda3/lib/python3.7/logging/handlers.py", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/Users/liam/opt/anaconda3/lib/python3.7/logging/handlers.py", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/Users/liam/opt/anaconda3/lib/python3.7/logging/__init__.py", line 1087, in __init__
    StreamHandler.__init__(self, self._open())
  File "/Users/liam/opt/anaconda3/lib/python3.7/logging/__init__.py", line 1116, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/liam/Desktop/Git/Blogin/logs/blogin.log'
weijiang1994 commented 3 years ago

You need create a log file named blogin.log on the /Users/liam/Desktop/Git/Blogin/logs/ directory.

SuperTyrael commented 3 years ago

Hi, after I added that file, another error occured:

  File "/Users/liam/Desktop/Git/Blogin/blogin/__init__.py", line 212, in admin
    avatar='/static/img/admin/admin.jpg')
  File "<string>", line 4, in __init__
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/sqlalchemy/orm/state.py", line 433, in _initialize_instance
    manager.dispatch.init_failure(self, args, kwargs)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 69, in __exit__
    exc_value, with_traceback=exc_tb,
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/sqlalchemy/orm/state.py", line 430, in _initialize_instance
    return manager.original_init(*mixed[1:], **kwargs)
  File "/Users/liam/Desktop/Git/Blogin/blogin/models.py", line 61, in __init__
    self.generate_avatar()
  File "/Users/liam/Desktop/Git/Blogin/blogin/models.py", line 75, in generate_avatar
    files = icon.generate(self.username)
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask_avatars/identicon.py", line 220, in generate
    self.save(image_byte_array, save_location=os.path.join(path, '%s_%s.png' % (text, suffix[size])))
  File "/Users/liam/Desktop/Git/Blogin/env/lib/python3.7/site-packages/flask_avatars/identicon.py", line 82, in save
    with open(save_location, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/liam/Desktop/Git/Blogin/uploads/avatars/liam123456_s.png'
操作出现异常,退出...
SuperTyrael commented 3 years ago

@weijiang1994

weijiang1994 commented 3 years ago

I forgot to upload some necessary directories, please wait a moment and then you can manually create the directory by yourself, or re-clone the code of my repo。

SuperTyrael commented 3 years ago

OK, it runs well after I created that file. Thank you SO MUCH for sharing this project with us, that's really helpful for fresh like me.