Django Dialogflow is a web client to chat.
- API View
- Sync your database
- Production your BOT
- Installation
- Configuring Webservice
- Examples
- Motivationl
- License
- Contributing
If you need a django_dialogflow API endpoint you will want to add the following to your urls.py
urlpatterns = [
url(r'chat/$', chat_view, name='chat'),
url(r'^$', index_view, name='index'),
url(r'^admin/', admin.site.urls),
]
The endpoint expects a JSON request with the following data:
{"text": "My input statement"}
See detailed example how retrieve end point translated information app.html
You will then want to create the necessary tables. If you generating schema migrations, you'll want to run:
$ python manage.py migrate django_dialogflow
To configure Dialogflow client access token, go settings.py
# Dialogflow settings
DIALOGFLOW = {
'client_access_token': 'e5dc21cab6df451c866bf5efacb40178',
}
Modify Django Allowed hosts to access your application everywhere, to do this modify settings.py as suggested below
ALLOWED_HOSTS = ['A.B.C.D', 'localhost']
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served.
To do this modify settings.py as suggested below
CORS_ORIGIN_WHITELIST = (
'A.B.C.D:9000',
)
python manage.py runserver 0.0.0.0:8000
Further documentation on getting set up with Django and ChatterBot can be found in the ChatterBot documentation
If you are trying django_dialogflow
as app,
Then you could install django-dialogflow either via the Python Package Index (PyPI) or from source.
To install using pip :
$ pip install django-dialogflow
and then add it to your installed apps:
INSTALLED_APPS = (
...
'django_dialogflow',
...
)
If you want to host your Django app, you need to choose a method through which it will be hosted. There are a few free services that you can use to do this such as Heroku and PythonAnyWhere.
A common method for serving Python web applications involves using a Web Server Gateway Interface (WSGI) package.
Gunicorn is a great choice for a WSGI server. They have detailed documentation and installation instructions on their website.
There are numerous ways to host static files for your Django application. One extreemly easy way to do this is by using WhiteNoise, a python package designed to make it possible to serve static files from just about any web application.
You can clone the git repository by doing the following:
$ git clone git:https://github.com/vkosuri/django-dialogflow.git
All examples are located here Github repo
https://github.com/gunthercox/django_chatterbot
Licensed under MIT
Development of django_dialogflow happens at Github: http:https://github.com/vkosuri/django-dialogflow
You are highly encouraged to participate in the development. If you don't like Github (for some reason) you're welcome to send regular patches.