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

Internet access required for client? #51

Closed
samesand opened this issue Apr 15, 2020 · 16 comments
Closed

Internet access required for client? #51

samesand opened this issue Apr 15, 2020 · 16 comments

Comments

@samesand
Copy link

I have deployed a web page on my intranet using Justpy (which is great by the way!), but I have a couple of clients that do not have access internet access, and they cannot display the web page, as soon as I enable internet access they are able to display the page correctly, but I cannot leave internet access enabled.

Any work around or setting I can modify to make a justpy page work without internet access?

@knoxvilledatabase
Copy link

This was already resolved: #33

justpy.env
STATIC_DIRECTORY = static/
TEMPLATES_DIRECTORY = static/templates

Then make a copy of all of the templates from https://github.com/elimintz/justpy/tree/master/justpy/templates

Then download all of the resources and source the path in the template file.

@samesand
Copy link
Author

Thanks!

If I'm not using any custom templates, is there any thing else I need to do besides copying the templates and modifying the justpy.env file?

@elimintz
Copy link
Collaborator

@samesand
Please upgrade to version 0.0.9 (just released today) and add the following line to justpy.env:
NO_INTERNET = True

This is a much more simple solution I hope.
Let me know if this works well for you.

@knoxvilledatabase
Copy link

Thats awesome!

@samesand
Copy link
Author

samesand commented Apr 23, 2020 via email

@samesand
Copy link
Author

@samesand
Please upgrade to version 0.0.9 (just released today) and add the following line to justpy.env:
NO_INTERNET = True

This is a much more simple solution I hope.
Let me know if this works well for you.

I tried this today after upgrading to 0.0.9, but the client is still asking for internet connection. Is there anything else I need to do in addition to edit the justpy.env?

@samesand samesand reopened this Apr 23, 2020
@elimintz
Copy link
Collaborator

Could you please post a program you have problems with?
Could be it can't get the default favicon but that shouldn't stop the page from loading. What client are you using?

@samesand
Copy link
Author

Actually, I just tested changing the host and the port number using the justpy.env file and it doesn't have any effect, so it seems that it's not reading the configuration file. Here is what I have:

  • a justpy.env file on the same folder as my python file
  • a line in my python file with config = justpy.Config('justpy.env')

Is there anything else I need?

Thanks.

@samesand
Copy link
Author

Could you please post a program you have problems with?
Could be it can't get the default favicon but that shouldn't stop the page from loading. What client are you using?

Google Chrome on Windows 10

@elimintz
Copy link
Collaborator

I think the problem may be that you added

config = justpy.Config('justpy.env')

to your program. Remove this line and see what happens.

@samesand
Copy link
Author

samesand commented Apr 27, 2020

I tried and I got the same result. This is my code:

` import datetime as dt
import time
import probedataextraction as pde

import dataprocessing as dp
import webpageclasses as wpc
import datetime as dt
import pandas as pd

import justpy as jp
import time
import asyncio


LOCATIONS = {
	"N_PRB45": 0,
	"N_PRB48": 1,
	"N_PRB54": 2,
}

tools = {}
wp = jp.WebPage(classes="ml-1", delete_flag=False)

# create containers

row_2 = jp.Div(classes="flex mt-3", a=wp)
row_1 = jp.Div(classes="flex mt-3", a=wp)
cell_1 = jp.Div(classes="flex w-1/2 flex-wrap", a=row_1)
cell_2 = jp.Div(classes="flex w-1/2 flex-wrap", a=row_1)
cell_blank = jp.Div(classes="w-1/2 ml-3", a=row_2)
cell_3 = jp.Div(classes="flex w-1/2 flex-wrap", a=row_2)

# title and clock
title = jp.Div(
	text="Probe Dashboard",
	classes="max-w-sm text-5xl overflow-hidden text-left",
	a=cell_blank,
)

clock = jp.Div(
	text="00:00:00",
	classes="max-w-sm text-3xl overflow-hidden text-left",
	a=cell_blank,
)

cells = [cell_1, cell_2, cell_3]

for tool in LOCATIONS.keys():

	tools[tool] = wpc.Tool(tool, cells[LOCATIONS[tool]])
	tools[tool].add_chamber(tool)
	tools[tool].add_csst(tool)

async def board_update():
	while True:
		mapfiles = pde.map_files()
		standards = pde.standards()
		current_state = dp.map_file_summary(mapfiles)
		current_state = dp.add_probe_standards(current_state, standards, on="part")
		current_state = dp.prober_state(current_state)
		tools_dict = current_state.set_index("tool").to_dict(orient="index")

		for tool in tools_dict.keys():
			tool_data = tools_dict[tool]

			if tool_data["state"] in ["short_delay", "long_delay", "completed"]:
				elapsed_time = dt.datetime.now() - tool_data["end_dt"]
			else:
				elapsed_time = dt.datetime.now() - tool_data["start_dt"]

			elapsed_time = str(elapsed_time).split(" ")[-1].split(".")[0]
			tools[tool].cssts[tool].set_state(tool_data["state"])
			tools[tool].cssts[tool].set_lot(tool_data["lot"])
			tools[tool].cssts[tool].set_wafer(tool_data["wafer"])
			tools[tool].cssts[tool].set_recipe(tool_data["part"])
			tools[tool].cssts[tool].set_time(elapsed_time[:-3])

		clock.text = dt.datetime.now().strftime("%H:%M")
		jp.run_task(wp.update())
		await asyncio.sleep(60)


async def board_init():
	jp.run_task(board_update())

async def webpage():
	return wp

jp.justpy(webpage, startup=board_init)

`

@elimintz
Copy link
Collaborator

I don't have access to some libraries you are importing so can't run the program.

Try the following simple program:

import justpy as jp

def internet_test():
    wp = jp.WebPage()
    jp.Hello(a=wp)
    return wp

jp.justpy(internet_test)

justpy.env looks like this:

NO_INTERNET = True

I disconnect my internet and it runs. Please try it on your end and let me know what happens.

@samesand
Copy link
Author

Try the following simple program:

I tried the program with the same result. I added the HOST and PORT configuration lines to the justpy.env file to see if they had any effect, and they don't, so it seems that it's not reading the juspy.env file or ignoring it.

Thanks for your help.

@elimintz
Copy link
Collaborator

Could you please check that the file in the directory the program is run from? I can't think of any other reason why this would not work.

@samesand
Copy link
Author

samesand commented May 1, 2020

Could you please check that the file in the directory the program is run from? I can't think of any other reason why this would not work.

I have the justpy.env in the same folder as the file I posted before. I created the file with notepad.

@elimintz
Copy link
Collaborator

elimintz commented May 1, 2020

I'm sorry, I can't think of a reason this would not work. I can't replicate the issue.

@elimintz elimintz closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants