-
-
Notifications
You must be signed in to change notification settings - Fork 22
Django IDOM #1
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
Django IDOM #1
Conversation
Thanks! I'll look this over shortly. |
@Archmonger IDOM 0.29.0 was just released and contains a fix so that we won't need to do |
@rmorshea Resolved all startup errors under this repo's default configuration, I'll look to implement some tests soon. |
@rmorshea Getting a test_suite fail on GH actions, seems to be due to "figure-it-out" noxfile.py:53 |
Yup, I think a test that goes something like this should be totally sufficient: import idom
def test_simple_counter():
run_the_app_somehow()
web_driver = make_the_web_driver_somehow()
@idom.component
def Counter():
count, set_count = idom.hooks.use_state(0)
return idom.html.div(
idom.html.button(
{"id": "incr", "onClick": lambda event: set_count(count + 1)},
"Click me!",
),
idom.html.p(
{"id": "count", "data-count": count}, f"Current count is: {count}"
)
)
counter_button = web_driver.find_element_by_id("incr")
counter_view = web_dirver.find_element_by_id("count")
for i in range(5):
assert counter_view.get_attribute("data-count") == i
counter_button.click() Anything beyond that is nice but probably not necessary right now. Basically we just want to check that the end-to-end works. |
I think I'll need to tag up with you regarding the frontend-backend connection via django. Not sure how to get those components to actually appear in a django fashion. |
I think there's some docs on on how to set up a test using Selenium: https://docs.djangoproject.com/en/3.2/topics/testing/tools/#liveservertestcase If there's not enough info there, grab a weekly office hour slot and we'll figure it out: reactive-python/reactpy#312 |
There's some critical bugs in IDOM that need attention. Probably won't have time to work on this for another week or so. |
Does the commit from 6 days ago address the critical bugs you brought up? |
It does. I plan to release it soon. I'll then have some time to return to this after the two remaining open PRs are merged.. |
Ok, I'm not free to start working on this again. |
😂 I've been focused on Pyarr development but I'll have time to return to this soonish |
Edit: I'm now free to start working on this again. |
Can't wait to test this out!! This is the last piece of the puzzle for developing the Conreq community app store! |
I'm gonna go ahead and merge this, but I really do think we should provide an app that encapsulates what was done in Ideally one would be able to install |
I can show you how to make reusable templates. That one is fairly simple, but it might be awkward given the current repo structure of using test_app |
@Archmonger it'd be great to organize another working session to get through that. |
We can plan something out around your schedule, let me know your availability. |
@rmorshea Something came up so I'll need to cancel our 11. I'll be able to do later in the evening if you're free. |
Should be fine. Just let me know when you're able. |
@Archmonger still able to meet? |
@rmorshea just freed up, lemme know when you wanna meet |
Moved the event. |
This is the most minimalistic Django configuration possible that can support Websockets.
I've used folder structure and file naming schemes suggested by Django documentation.
Also included the Daphne webserver in the requirements for testing on more than just the development webserver.
In order to get this configuration running
cd <repo_root_dir>
pip install requirements.txt
python manage.py migrate
to create the initial databasepython manage.py runserver
to run the django development test server. Alternatively,daphne dj_idom.asgi:application
to run the production-grade webserver.Here's the files in the repo:
dj_idom/static/scripts.js
: Client side websocketdj_idom/templates/base.html
: HTML base template.dj_idom/consumers.py
: Server side websocketdj_idom/asgi.py
: Websocket URL routingdj_idom/urls.py
: HTTP URL routingdj_idom/settings.py
: Django boot time configmanage.py
: Django project management utility