Skip to content

Commit d62e137

Browse files
authored
Merge branch 'main' into archmonger
2 parents 54af7c5 + 6b64aa2 commit d62e137

File tree

5 files changed

+61
-33
lines changed

5 files changed

+61
-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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
__version__ = "0.0.1"
2-
31
from .websocket_consumer import IdomAsyncWebSocketConsumer
42

5-
3+
__version__ = "0.0.1"
64
__all__ = ["IdomAsyncWebSocketConsumer"]

tests/test_app/asgi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414

1515
from .views import Root
1616

17+
from django_idom import IdomAsyncWebSocketConsumer # noqa: E402
18+
1719

1820
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
1921

2022
# Fetch ASGI application before importing dependencies that require ORM models.
2123
http_asgi_app = get_asgi_application()
2224

23-
from channels.routing import ProtocolTypeRouter, URLRouter
25+
from channels.routing import ProtocolTypeRouter, URLRouter # noqa: E402
2426

25-
from django_idom import IdomAsyncWebSocketConsumer
2627

2728

2829
application = ProtocolTypeRouter(

tests/test_app/settings.py

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +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

1516

1617
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1718
BASE_DIR = Path(__file__).resolve().parent.parent
18-
19+
SRC_DIR = BASE_DIR.parent / "src"
1920

2021
# Quick-start development settings - unsuitable for production
2122
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
@@ -25,12 +26,9 @@
2526

2627
# SECURITY WARNING: don't run with debug turned on in production!
2728
DEBUG = True
28-
2929
ALLOWED_HOSTS = []
3030

31-
3231
# Application definition
33-
3432
INSTALLED_APPS = [
3533
"django.contrib.admin",
3634
"django.contrib.auth",
@@ -41,7 +39,6 @@
4139
"channels", # Websocket library
4240
"test_app", # This test application
4341
]
44-
4542
MIDDLEWARE = [
4643
"django.middleware.security.SecurityMiddleware",
4744
"django.contrib.sessions.middleware.SessionMiddleware",
@@ -51,9 +48,7 @@
5148
"django.contrib.messages.middleware.MessageMiddleware",
5249
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5350
]
54-
5551
ROOT_URLCONF = "test_app.urls"
56-
5752
TEMPLATES = [
5853
{
5954
"BACKEND": "django.template.backends.django.DjangoTemplates",
@@ -69,13 +64,11 @@
6964
},
7065
},
7166
]
72-
7367
ASGI_APPLICATION = "test_app.asgi.application"
74-
68+
sys.path.append(str(SRC_DIR))
7569

7670
# Database
7771
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
78-
7972
DATABASES = {
8073
"default": {
8174
"ENGINE": "django.db.backends.sqlite3",
@@ -86,10 +79,8 @@
8679
},
8780
}
8881

89-
9082
# Password validation
9183
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
92-
9384
AUTH_PASSWORD_VALIDATORS = [
9485
{
9586
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
@@ -105,38 +96,26 @@
10596
},
10697
]
10798

108-
10999
# Internationalization
110100
# https://docs.djangoproject.com/en/3.2/topics/i18n/
111-
112101
LANGUAGE_CODE = "en-us"
113-
114102
TIME_ZONE = "UTC"
115-
116103
USE_I18N = True
117-
118104
USE_L10N = True
119-
120105
USE_TZ = True
121106

122107

123-
# Static files (CSS, JavaScript, Images)
124-
# https://docs.djangoproject.com/en/3.2/howto/static-files/
125-
126-
STATIC_URL = "/static/"
127-
128108
# Default primary key field type
129109
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
130-
131110
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
132-
133111
STATIC_ROOT = os.path.join(BASE_DIR, "static-deploy")
134112

135113
# Static Files (CSS, JavaScript, Images)
114+
# https://docs.djangoproject.com/en/3.2/howto/static-files/
115+
STATIC_URL = "/static/"
136116
STATICFILES_DIRS = [
137117
os.path.join(BASE_DIR, "test_app", "static"),
138118
]
139-
140119
STATICFILES_FINDERS = [
141120
"django.contrib.staticfiles.finders.FileSystemFinder",
142121
"django.contrib.staticfiles.finders.AppDirectoriesFinder",

0 commit comments

Comments
 (0)