Skip to content

Can we add if __name__ == "__main__": guards to the hello world examples and the documentation examples? #168

@leunga1000

Description

@leunga1000

Is your feature request related to a problem? Please describe.
Hey, thanks for making socketify.py

Got a little bit confused between running the app in the code and via the cli.

Started with the hello world, trying to set the host and port (admittedly don't need to do this much), then tried to run that code with the cli interface. It ran but ignored the options - it was running the application code when importing the module in load_module and stopping there.

Describe the solution you'd like

  • Just update the docs and examples for helloworld app.run() calls to be preceded by a name == main clause.
  • And also add applistenoptions example to the docs.
  • maybe add an additional error message in the cli code for when the app is also defined in the if clause, and the import does not find the app.

Additional context
Don't mind to do this if you don't have time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions