pull/75/head
Ciro 2022-12-20 07:17:12 -03:00
rodzic 9b859b9266
commit ffd54b04ea
20 zmienionych plików z 195 dodań i 3 usunięć

Wyświetl plik

@ -10,6 +10,6 @@ def index():
response.content_type = "text/plain"
return response
WSGI(app).listen(8000, lambda config: print(f"Listening on port http://localhost:{config.port} now\n")).run()
if __name__ == "__main__":
WSGI(app).listen(8000, lambda config: print(f"Listening on port http://localhost:{config.port} now\n")).run()

Wyświetl plik

@ -0,0 +1,21 @@
"""
WSGI config for hello project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello.settings")
from django.core.asgi import get_asgi_application
application = get_asgi_application()

Wyświetl plik

@ -0,0 +1,52 @@
import os
DEBUG = False
SECRET_KEY = '_7mb6#v4yf@qhc(r(zbyh&z_iby-na*7wz&-v6pohsul-d#y5f'
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {}
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
USE_I18N = False
USE_L10N = False
USE_TZ = False
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = ()
MIDDLEWARE = ()
ROOT_URLCONF = 'hello.urls'
WSGI_APPLICATION = 'hello.wsgi.application'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {},
},
]
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'world',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'handlers': {},
'loggers': {},
}
ALLOWED_HOSTS = ['*']

Wyświetl plik

@ -0,0 +1,7 @@
from django.urls import path
from world.views import plaintext, json
urlpatterns = [
path('plaintext', plaintext, name='plaintext'),
path('json', json, name='json'),
]

Wyświetl plik

@ -0,0 +1,2 @@
django==4.1.4
git+https://github.com/cirospaciari/socketify.py.git@main#socketify

Wyświetl plik

@ -0,0 +1,13 @@
from json import dumps
from django.http import HttpResponse
async def plaintext(request):
return HttpResponse("Hello, World!", content_type="text/plain")
async def json(request):
return HttpResponse(
dumps({"message": "Hello, World!"}),
content_type="application/json"
)

Wyświetl plik

@ -0,0 +1,52 @@
import os
DEBUG = False
SECRET_KEY = '_7mb6#v4yf@qhc(r(zbyh&z_iby-na*7wz&-v6pohsul-d#y5f'
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {}
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
USE_I18N = False
USE_L10N = False
USE_TZ = False
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = ()
MIDDLEWARE = ()
ROOT_URLCONF = 'hello.urls'
WSGI_APPLICATION = 'hello.wsgi.application'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {},
},
]
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'world',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'handlers': {},
'loggers': {},
}
ALLOWED_HOSTS = ['*']

Wyświetl plik

@ -0,0 +1,7 @@
from django.urls import path
from world.views import plaintext, json
urlpatterns = [
path('plaintext', plaintext, name='plaintext'),
path('json', json, name='json'),
]

Wyświetl plik

@ -0,0 +1,21 @@
"""
WSGI config for hello project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Wyświetl plik

@ -0,0 +1,2 @@
django==4.1.4
git+https://github.com/cirospaciari/socketify.py.git@main#socketify

Wyświetl plik

@ -0,0 +1,13 @@
from json import dumps
from django.http import HttpResponse
def plaintext(request):
return HttpResponse("Hello, World!", content_type="text/plain")
def json(request):
return HttpResponse(
dumps({"message": "Hello, World!"}),
content_type="application/json"
)

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 51 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 33 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 53 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 41 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 33 KiB

Wyświetl plik

@ -1,5 +1,6 @@
import inspect
import os
import logging
from . import App, AppOptions, AppListenOptions
help = """
Usage: python -m socketify APP [OPTIONS]
@ -81,7 +82,8 @@ def load_module(file, reload=False):
if is_factory(module):
app = app()
return app
except:
except Exception as error:
logging.exception(error)
return None
def execute(args):
arguments_length = len(args)