from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from aspen import log_dammit
from aspen.website import Website
from wsgiref.simple_server import make_server


if __name__ == '__main__':
    website = Website()
    server = make_server('0.0.0.0', 8080, website)
    log_dammit("Greetings, program! Welcome to port 8080.")
    server.serve_forever()

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os
from aspen import log_dammit
from aspen.website import Website
from wsgiref.simple_server import make_server


if __name__ == '__main__':
    website = Website()
    port = int(os.environ.get('PORT', '8080'))
    server = make_server('0.0.0.0', port, website)
    log_dammit("Greetings, program! Welcome to port {0}.".format(port))
    server.serve_forever()

Support PORT envvar from `python -m aspen`
Support PORT envvar from `python -m aspen`

  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  
+ import os
  from aspen import log_dammit
  from aspen.website import Website
  from wsgiref.simple_server import make_server
  
  
  if __name__ == '__main__':
      website = Website()
+     port = int(os.environ.get('PORT', '8080'))
-     server = make_server('0.0.0.0', 8080, website)
+     server = make_server('0.0.0.0', port, website)
-     log_dammit("Greetings, program! Welcome to port 8080.")
+     log_dammit("Greetings, program! Welcome to port {0}.".format(port))
      server.serve_forever()
  
Support PORT envvar from `python -m aspen`
## Code Before:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from aspen import log_dammit
from aspen.website import Website
from wsgiref.simple_server import make_server


if __name__ == '__main__':
    website = Website()
    server = make_server('0.0.0.0', 8080, website)
    log_dammit("Greetings, program! Welcome to port 8080.")
    server.serve_forever()

## Instruction:
Support PORT envvar from `python -m aspen`
## Code After:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os
from aspen import log_dammit
from aspen.website import Website
from wsgiref.simple_server import make_server


if __name__ == '__main__':
    website = Website()
    port = int(os.environ.get('PORT', '8080'))
    server = make_server('0.0.0.0', port, website)
    log_dammit("Greetings, program! Welcome to port {0}.".format(port))
    server.serve_forever()
