{ "info": { "author": "Victor Hu", "author_email": "selain@nature.ee.ncku.edu.tw", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6" ], "description": "# Django-Eel\n\nDjango-Eel is a Django App for HTML GUI applications, with easy Python/JS interoperation. It is a porting version of [Eel](https://github.com/ChrisKnott/Eel).\n\n### Repo branches\n\n - **master** : the master branch of Django-Eel\n - **eel-master** : keeping sync with [Eel](https://github.com/ChrisKnott/Eel)/master\n\n### Requirements\n\n - Django ( >=2.0.7 recommended )\n - channels ( >=2.1.2 recommended )\n - gevent ( >=1.3.4 recommended )\n\n### Getting Started\n\n#### Installation\n\nDownload Django-Eel package from GitHub and install:\n```\npython setup.py install\n```\nOr install through PIP:\n```\npip install git+https://github.com/seLain/django-eel\n```\n\n#### Create demo project\n\nCreate an empty django project:\n```\ndjango-admin startproject demo\n```\nCreate examples django app:\n```\ndjango-admin startapp example\n```\nAdd **channels**, **django_eel**, and **example** to **demo/settings.py**\n```python\nINSTALLED_APPS = [\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n 'channels',\n 'django_eel',\n 'example',\n]\n```\nSet ASGI_Application in **demo/settings.py**. It is required by channels.\n```python\nWSGI_APPLICATION = 'demo.wsgi.application'\nASGI_APPLICATION = \"demo.routing.application\"\n```\nAdd **routine.py** under **demo** project root. The **routine.py** routes websocket requests to **EelConsumer**.\n```python\nfrom channels.routing import ProtocolTypeRouter, URLRouter\nfrom django.conf.urls import url\nfrom django_eel.consumers import EelConsumer\n\napplication = ProtocolTypeRouter({\n # (http->django views is added by default)\n \"websocket\": URLRouter([\n url(r\"^eel$\", EelConsumer), # do not alter this line\n ]),\n})\n```\nConfigure demo\\urls.py to route http request to eel and example respectively.\n```python\nurlpatterns = [\n path('admin/', admin.site.urls),\n url(r'^eel/', include('django_eel.urls')), # do not alter this line\n url(r'^example/', include('example.urls')), # set by your app name\n]\n```\nThat's the configuration part. Now we add a helloword example.\n\n#### Create template and view\n\nCreate **example\\templates\\example\\hello.html** :\n```html\n\n\n \n Hello, World!\n \n \n \n \n \n \n \n Hello, World!\n \n\n```\nThis **hello.html** is almost the same as the original [Eel](https://github.com/ChrisKnott/Eel) example, except the request for **eel.js**.\n\nThen we create the view \n```python\nfrom django.shortcuts import render\nimport django_eel as eel\n\n# initialize eel\neel.init('example/templates/example')\n\n###########################\n# Hello example\n###########################\ndef hello_page(request): # accept request for hello.html\n\treturn render(request, 'example/hello.html')\n\n@eel.expose\ndef say_hello_py(x):\n\tprint('Hello from %s' % x)\n\teel.say_hello_js('Python3 and Django World!') # call js function\n\n###########################\n# Open local browser\n###########################\neel.start('example/hello', size=(300, 200)) # optional for off-line browsing\n```\n\nFinally, we have to set **example\\urls.py** to handle the request to example pages.\n```python\nfrom django.conf.urls import url\n\nfrom .views import hello_page\n\nurlpatterns = [\n url(r'^hello$', hello_page),\n]\n```\n\n#### Running the demo\n\nSimply run the django project as usual:\n```\npython manage.py runserver\n```\nA browser windows should popup if this line is added in view.\n```python\neel.start('example/hello', size=(300, 200))\n```\nYou can also access the hello example by browser:\n```\nhttp://localhost:8000/example/hello\n```\nThat's it. All behaviors are basically the same as the original [Eel](https://github.com/ChrisKnott/Eel).", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/seLain/Django-Eel/tarball/v0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/seLain/Django-Eel", "keywords": "gui,javascript,python,html,django", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-eel", "package_url": "https://pypi.org/project/django-eel/", "platform": "", "project_url": "https://pypi.org/project/django-eel/", "project_urls": { "Download": "https://github.com/seLain/Django-Eel/tarball/v0.1", "Homepage": "https://github.com/seLain/Django-Eel" }, "release_url": "https://pypi.org/project/django-eel/0.11/", "requires_dist": null, "requires_python": "", "summary": "A Django App for little HTML GUI applications, with easy Python/JS interoperation.", "version": "0.11" }, "last_serial": 4064688, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "13efb7e2d45027b596bdcbc891f5cd20", "sha256": "5a48fc455187d5d621504949008b4861aa068a79b72b639d2fd69595cae5a8b4" }, "downloads": -1, "filename": "django-eel-0.1.tar.gz", "has_sig": false, "md5_digest": "13efb7e2d45027b596bdcbc891f5cd20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8726, "upload_time": "2018-07-16T06:23:03", "url": "https://files.pythonhosted.org/packages/7b/ae/e75f8109bdb97abe9817cae712cb70aee653cb514cae26b37bcf9f398333/django-eel-0.1.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "fd7332449238dc056da3ef6dd8cfac6c", "sha256": "6a14a06829a03435a8200f0583dc7024d223e222b1d65a1c1a6cdd13dfec2c54" }, "downloads": -1, "filename": "django-eel-0.11.tar.gz", "has_sig": false, "md5_digest": "fd7332449238dc056da3ef6dd8cfac6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9307, "upload_time": "2018-07-16T06:45:02", "url": "https://files.pythonhosted.org/packages/f1/89/1db67060013e9c865e0e2f5f7dd5ef033016e7a5c0275591c97b01ed12f6/django-eel-0.11.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fd7332449238dc056da3ef6dd8cfac6c", "sha256": "6a14a06829a03435a8200f0583dc7024d223e222b1d65a1c1a6cdd13dfec2c54" }, "downloads": -1, "filename": "django-eel-0.11.tar.gz", "has_sig": false, "md5_digest": "fd7332449238dc056da3ef6dd8cfac6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9307, "upload_time": "2018-07-16T06:45:02", "url": "https://files.pythonhosted.org/packages/f1/89/1db67060013e9c865e0e2f5f7dd5ef033016e7a5c0275591c97b01ed12f6/django-eel-0.11.tar.gz" } ] }