Skip to content

Instantly share code, notes, and snippets.

@0xIslamTaha
Created November 12, 2019 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xIslamTaha/a4a9f51ac9e6d1db064a1f59a2af6517 to your computer and use it in GitHub Desktop.
Save 0xIslamTaha/a4a9f51ac9e6d1db064a1f59a2af6517 to your computer and use it in GitHub Desktop.
from Jumpscale import j
server = j.servers.openresty.get("test")
server.install(reset=True)
server.configure()
website = server.websites.get("test")
website.ssl = False
locations = website.locations.get("main")
website_location = locations.locations_static.new()
website_location.name = "home"
website_location.path_url = "/website"
website_location.path_location = "/sandbox/code/github/threefoldtech/jumpscaleX_core/JumpscaleCore/servers/openresty/examples/website/"
lapis_location = locations.locations_lapis.new()
lapis_location.name = "apps"
lapis_location.path_url = "/"
lapis_location.path_location = "/sandbox/code/github/threefoldtech/jumpscaleX_core/JumpscaleCore/servers/openresty/examples/lapis"
static_location = locations.locations_static.new()
static_location.name = "static"
static_location.path_url = "/static"
static_location.path_location = "/sandbox/code/github/threefoldtech/jumpscaleX_core/JumpscaleCore/servers/openresty/web_resources/static"
static_location.use_jumpscale_weblibs = True
locations.configure()
website.configure()
server.start()
lapis_content = j.clients.http.get("http://0.0.0.0/")
assert (
lapis_content
== '<!DOCTYPE HTML><html lang="en"><head><title>Lapis Page</title></head><body>Hello from lapis!</body></html>'
)
static_content = j.clients.http.get("http://0.0.0.0/website/")
import ipdb; ipdb.set_trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment