Skip to content

ValueError: 'name' may not contain a dot '.' character. when execute flask run #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janaka1984 opened this issue May 27, 2021 · 6 comments

Comments

@janaka1984
Copy link

$ flask run

  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
    Traceback (most recent call last):
    File "c:\users\janaka_w\appdata\local\programs\python\python36\Lib\runpy.py", line 193, in _run_module_as_main
    "main", mod_spec)
    File "c:\users\janaka_w\appdata\local\programs\python\python36\Lib\runpy.py", line 85, in run_code
    exec(code, run_globals)
    File "E:\PYTHON TEST PROJECT\example-oauth2-server-master\env-auth\Scripts\flask.exe_main
    .py", line 7, in
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 990, in main
    cli.main(args=sys.argv[1:])
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 596, in main
    return super().main(*args, **kwargs)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 845, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 321, in init
    self._load_unlocked()
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 346, in _load_unlocked
    self._app = rv = self.loader()
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 406, in load_app
    app = locate_app(self, import_name, None, raise_if_not_found=False)
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\cli.py", line 256, in locate_app
    import(module_name)
    File "E:\PYTHON TEST PROJECT\example-oauth2-server-master\app.py", line 1, in
    from website.app import create_app
    File "E:\PYTHON TEST PROJECT\example-oauth2-server-master\website\app.py", line 5, in
    from .routes import bp
    File "E:\PYTHON TEST PROJECT\example-oauth2-server-master\website\routes.py", line 11, in
    bp = Blueprint(name, 'home')
    File "e:\python test project\example-oauth2-server-master\env-auth\lib\site-packages\flask\blueprints.py", line 195, in init
    raise ValueError("'name' may not contain a dot '.' character.")
    ValueError: 'name' may not contain a dot '.' character.
@yangjinghit
Copy link

i got the same issue, have you solved it ? @janaka1984

@yangjinghit
Copy link

Flask==1.1.2
Flask-SQLAlchemy==2.5.1
Authlib==0.14.3
this version is ok

@TechStudent10
Copy link

I think the issue is in websites/routes.py. Change this line:

bp = Blueprint(__name__, 'home')

to this line:

bp = Blueprint('home', __name__)

and it should work.

@lepture
Copy link
Member

lepture commented Jun 21, 2021

updated the demo. Thanks @TechStudent11

@lepture lepture closed this as completed Jun 21, 2021
@TechStudent10
Copy link

@lepture no prob :)

@bera-bin-le
Copy link

@lepture the main branch README still has the wrong example code (the Hello World section).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants