Skip to content

Commit

Permalink
Merge pull request #160 from justmobilize/remove-wsgiserver
Browse files Browse the repository at this point in the history
Remove wsgiserver
  • Loading branch information
dhalbert authored Apr 25, 2024
2 parents f78907e + 87a590b commit 93e8bb3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 447 deletions.
64 changes: 0 additions & 64 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,70 +108,6 @@ wifitest.adafruit.com.
print("Done!")
This example demonstrates a simple web server that allows setting the Neopixel color.

.. code-block:: python
import board
import busio
import digitalio
import neopixel
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_wsgiserver as server
from adafruit_wsgi.wsgi_app import WSGIApp
print("Wiznet5k Web Server Test")
# Status LED
led = neopixel.NeoPixel(board.NEOPIXEL, 1)
led.brightness = 0.3
led[0] = (0, 0, 255)
# W5500 connections
cs = digitalio.DigitalInOut(board.D10)
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
# Initialize Ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs)
# Here we create our application, registering the
# following functions to be called on specific HTTP GET requests routes
web_app = WSGIApp()
@web_app.route("/led/<r>/<g>/<b>")
def led_on(request, r, g, b):
print("LED handler")
led.fill((int(r), int(g), int(b)))
return ("200 OK", [], ["LED set!"])
@web_app.route("/")
def root(request):
print("Root handler")
return ("200 OK", [], ["Root document"])
@web_app.route("/large")
def large(request):
print("Large pattern handler")
return ("200 OK", [], ["*-.-" * 2000])
# Here we setup our server, passing in our web_app as the application
server.set_interface(eth)
wsgiServer = server.WSGIServer(80, application=web_app)
print("Open this IP in your browser: ", eth.pretty_ip(eth.ip_address))
# Start the server
wsgiServer.start()
while True:
# Our main loop where we have the server poll for incoming requests
wsgiServer.update_poll()
# Maintain DHCP lease
eth.maintain_dhcp_lease()
# Could do any other background tasks here, like reading sensors
Documentation
=============

Expand Down
240 changes: 0 additions & 240 deletions adafruit_wiznet5k/adafruit_wiznet5k_wsgiserver.py

This file was deleted.

3 changes: 0 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

.. automodule:: adafruit_wiznet5k.adafruit_wiznet5k_dns
:members:

.. automodule:: adafruit_wiznet5k.adafruit_wiznet5k_wsgiserver
:members:
Loading

0 comments on commit 93e8bb3

Please sign in to comment.