Comments (7)
Do you have the settings.js file included in your page?
from swampdragon.
I followed this tutorial. Did not see a settings.js included anywhere in this.
Disclaimer: I am new to this so I could be over looking something completely, but I have followed the tutorial step by step and not having any success.
from swampdragon.
In the adding template part of the tutorial you see the following code in the body of the page {% swampdragon_settings %}
If you're using django templates you should make sure that that line is there. If you're using something else such as a standalone front-end app you should include a link to the settings.js file manually like such
<script src="http://address_of_sd_host:9000/settings.js></script>
from swampdragon.
This is my html page. I am using django.
{% load static swampdragon_tags %}
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h2 id="sent"></h2>
<h2 id="rcvd"></h2>
<h2 id="cpu"></h2>
<!-- SwampDragon -->
{% swampdragon_settings %}
<script type="text/javascript" src="{% static 'swampdragon/js/dist/swampdragon.min.js' %}"></script>
<!-- Monitor -->
<script type="text/javascript" src="{% static 'monitor.js' %}"></script>
</body>
</body>
</html>
from swampdragon.
ok also saw elsewhere here that I needed to runmanage.py runsd
Did that now I get these errors.
GET http://127.0.0.1:8000/static/monitor.js [HTTP/1.0 404 NOT FOUND 17ms]
TypeError: window.swampDragons is undefined
from swampdragon.
Also here is my settings.py file
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '&@u#p(!j5ri51f#&flm3q4$13byl!(j1!qezvsxvh#e5-74%3$'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'swampdragon',
'monitor'
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'servermon.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'servermon.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
# SwampDragon settings
SWAMP_DRAGON_CONNECTION = ('swampdragon.connections.sockjs_connection.DjangoSubscriberConnection', '/data')
DRAGON_URL = 'http://localhost:9999/'
from swampdragon.
Welp solved my issue. Seems to be a combination of the following.
- Needed to tun
manage.py runsd
- Needed to change some configurations regarding static files in settings.py
replaced
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
with
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ( os.path.join('static'), )
from swampdragon.
Related Issues (20)
- how to implement swampdragon properly
- ERROR:tornado.general:WebSocket ... DoesNotExist: TodoList matching query does not exist.
- Settings.js HOT 3
- Synchronize Swampdragon in django cluster
- [frontend] How to handle arriving messages published to concrete channel HOT 6
- Todo tutorial - route not found HOT 2
- Idea: add template tag to make template parts update in realtime HOT 7
- has_related_value HOT 1
- Release version does not work with Django1.9 HOT 3
- settings.js not found HOT 2
- unit test does not support for auth
- How to avoid 'false' SwampDragon messages
- takeover
- Site can't be reached!? HOT 6
- Connection Swampdragon to a Redis Socket HOT 1
- About swampdragon.net HOT 1
- swampdragon.net site is down HOT 1
- I will to take this site maintanance and also to update it
- Private chat implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swampdragon.