Giter Club home page Giter Club logo

Comments (7)

anandology avatar anandology commented on July 30, 2024

How about making it take from web.config if specified? Something like this:

web.config.default_port = 8090
app.run()

from webpy.

nzjrs avatar nzjrs commented on July 30, 2024

I guess that would be sufficient, however I would prefer it be per application (config is global, right?).

Although not needed in my case, someone else might wish to run multiple servers on different ports.

from webpy.

nzjrs avatar nzjrs commented on July 30, 2024

Actually I just saw that config seems to hold other global state (smtp config for example), so there is precident.

web.config.default_port makes sense in that case.

from webpy.

anandology avatar anandology commented on July 30, 2024

we might want to support specifying the interface too. 127.0.0.1 to bind only on localhost.
Should we call it default_bind_address?

web.ctx.default_bind_address = '127.0.0.1:9000'

or just port:

web.ctx.default_bind_address = 9000

from webpy.

nzjrs avatar nzjrs commented on July 30, 2024

How about just calling it interface?

web.ctx.default_interface = 127.0.0.1:9000

And, in the port only case

web.ctx.default_interface = :9000

(i.e. starts with ':')

from webpy.

anandology avatar anandology commented on July 30, 2024

This can be solved by calling runsimple like this.

if __name__ == "__main__":
   web.httpserver.runsimple(app.wsgifunc(), ("0.0.0.0", 8888))

from webpy.

serverhorror avatar serverhorror commented on July 30, 2024

For the port only case in web.ctx.default_interface

web.ctx.default_interface = ::1

Do I now listen on port 1 with the default interface or on IPv6 loopback and the default port? Of course this:

web.ctx.default_interface = '[::1]'

would make it clear for IPv6.

I'd like a a default_address (as interfaces can have multiple addresses) and a default_port. Keeping with the explicit is better than implicit (pep-0020, second line in the zen of python) - yes I'm being a smartass here. Sorry :)

from webpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.