Skip to content

Commit 6ded303

Browse files
authored
Merge branch 'main' into archmonger
2 parents 0dc09fb + 6b64aa2 commit 6ded303

File tree

8 files changed

+69
-33
lines changed

8 files changed

+69
-33
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ jobs:
3030
run: pip install -r requirements/test-run.txt
3131
- name: Run Tests
3232
run: |
33-
npm install -g npm@v7.13.0
33+
npm install -g npm@latest
34+
npm --version
3435
nox -s test

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
11
# Django IDOM
22

3-
Support for IDOM in Django
3+
<a href="https://github.com/idom-team/django-idom/actions?query=workflow%3ATest">
4+
<img alt="Tests" src="https://github.com/idom-team/django-idom/workflows/Test/badge.svg?event=push" />
5+
</a>
6+
<a href="https://pypi.python.org/pypi/django-idom">
7+
<img alt="Version Info" src="https://img.shields.io/pypi/v/idom.svg"/>
8+
</a>
9+
<a href="https://github.com/idom-team/django-idom/blob/main/LICENSE">
10+
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-purple.svg">
11+
</a>
12+
13+
A package for building highly interactive user interfaces in pure Python inspired by
14+
[ReactJS](https://reactjs.org/).
15+
16+
**Be sure to [read the IDOM Documentation](https://idom-docs.herokuapp.com)!**
17+
18+
If you have ideas or find a bug, be sure to post an
19+
[issue](https://github.com/idom-team/django-idom/issues)
20+
or create a
21+
[pull request](https://github.com/idom-team/django-idom/pulls). Thanks in advance!
22+
23+
<h3>
24+
<a
25+
target="_blank"
26+
href="https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?filepath=notebooks%2Fintroduction.ipynb"
27+
>
28+
Try it Now
29+
<img alt="Binder" valign="bottom" height="25px"
30+
src="https://mybinder.org/badge_logo.svg"
31+
/>
32+
</a>
33+
</h3>
34+
35+
Click the badge above to get started! It will take you to a [Jupyter Notebooks](https://jupyter.org/)
36+
hosted by [Binder](https://mybinder.org/) with some great examples.
37+
38+
### Or Install it Now
39+
40+
```bash
41+
pip install django-idom
42+
```
43+
44+
# Django Integration
45+
46+
This version of IDOM can be directly integrated into Django. For example
47+
48+
```python
49+
# Example code goes here
50+
```
51+
52+
For examples on how to use IDOM, [read the IDOM Documentation](https://idom-docs.herokuapp.com).

src/django_idom/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
__version__ = "0.0.1"
2-
31
from .websocket_consumer import IdomAsyncWebSocketConsumer
42

3+
4+
__version__ = "0.0.1"
55
__all__ = ["IdomAsyncWebSocketConsumer"]

tests/test_app/asgi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@
1212
from django.conf.urls import url
1313
from django.core.asgi import get_asgi_application
1414

15+
from django_idom import IdomAsyncWebSocketConsumer # noqa: E402
16+
1517
from .views import HelloWorld
1618

19+
1720
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
1821

1922
# Fetch ASGI application before importing dependencies that require ORM models.
2023
http_asgi_app = get_asgi_application()
2124

22-
from channels.routing import ProtocolTypeRouter, URLRouter
25+
from channels.routing import ProtocolTypeRouter, URLRouter # noqa: E402
2326

24-
from django_idom import IdomAsyncWebSocketConsumer
2527

2628
application = ProtocolTypeRouter(
2729
{

tests/test_app/management/commands/build_js.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import subprocess
22
from pathlib import Path
3+
34
from django.core.management.base import BaseCommand
45

6+
57
HERE = Path(__file__).parent
68
JS_DIR = HERE.parent.parent.parent / "js"
79

tests/test_app/settings.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
https://docs.djangoproject.com/en/3.2/ref/settings/
1111
"""
1212
import os
13+
import sys
1314
from pathlib import Path
1415

16+
1517
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1618
BASE_DIR = Path(__file__).resolve().parent.parent
17-
19+
SRC_DIR = BASE_DIR.parent / "src"
1820

1921
# Quick-start development settings - unsuitable for production
2022
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
@@ -24,12 +26,9 @@
2426

2527
# SECURITY WARNING: don't run with debug turned on in production!
2628
DEBUG = True
27-
2829
ALLOWED_HOSTS = []
2930

30-
3131
# Application definition
32-
3332
INSTALLED_APPS = [
3433
"django.contrib.admin",
3534
"django.contrib.auth",
@@ -40,7 +39,6 @@
4039
"channels", # Websocket library
4140
"test_app", # This test application
4241
]
43-
4442
MIDDLEWARE = [
4543
"django.middleware.security.SecurityMiddleware",
4644
"django.contrib.sessions.middleware.SessionMiddleware",
@@ -50,9 +48,7 @@
5048
"django.contrib.messages.middleware.MessageMiddleware",
5149
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5250
]
53-
5451
ROOT_URLCONF = "test_app.urls"
55-
5652
TEMPLATES = [
5753
{
5854
"BACKEND": "django.template.backends.django.DjangoTemplates",
@@ -68,13 +64,11 @@
6864
},
6965
},
7066
]
71-
7267
ASGI_APPLICATION = "test_app.asgi.application"
73-
68+
sys.path.append(str(SRC_DIR))
7469

7570
# Database
7671
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
77-
7872
DATABASES = {
7973
"default": {
8074
"ENGINE": "django.db.backends.sqlite3",
@@ -85,10 +79,8 @@
8579
},
8680
}
8781

88-
8982
# Password validation
9083
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
91-
9284
AUTH_PASSWORD_VALIDATORS = [
9385
{
9486
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
@@ -104,38 +96,26 @@
10496
},
10597
]
10698

107-
10899
# Internationalization
109100
# https://docs.djangoproject.com/en/3.2/topics/i18n/
110-
111101
LANGUAGE_CODE = "en-us"
112-
113102
TIME_ZONE = "UTC"
114-
115103
USE_I18N = True
116-
117104
USE_L10N = True
118-
119105
USE_TZ = True
120106

121107

122-
# Static files (CSS, JavaScript, Images)
123-
# https://docs.djangoproject.com/en/3.2/howto/static-files/
124-
125-
STATIC_URL = "/static/"
126-
127108
# Default primary key field type
128109
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
129-
130110
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
131-
132111
STATIC_ROOT = os.path.join(BASE_DIR, "static-deploy")
133112

134113
# Static Files (CSS, JavaScript, Images)
114+
# https://docs.djangoproject.com/en/3.2/howto/static-files/
115+
STATIC_URL = "/static/"
135116
STATICFILES_DIRS = [
136117
os.path.join(BASE_DIR, "test_app", "static"),
137118
]
138-
139119
STATICFILES_FINDERS = [
140120
"django.contrib.staticfiles.finders.FileSystemFinder",
141121
"django.contrib.staticfiles.finders.AppDirectoriesFinder",

tests/test_app/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1919
"""
2020
from django.urls import path
21+
2122
from .views import base_template
2223

24+
2325
urlpatterns = [path("", base_template)]

tests/test_app/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import idom
2-
from django.template import loader
32
from django.http import HttpResponse
3+
from django.template import loader
44

55

66
def base_template(request):

0 commit comments

Comments
 (0)