Skip to content
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

Remove wsgiserver #160

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading