Skip to content

Dev #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Dev #183

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/chatserver/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

# Absolute path to the directory that holds static files.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.environ.get('DJANGO_STATIC_ROOT', '')
STATIC_ROOT = os.environ.get('DJANGO_STATIC_ROOT', 'static')

# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/"
Expand Down
5 changes: 5 additions & 0 deletions examples/chatserver/static/css/bootstrap.min.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions examples/chatserver/static/js/bootstrap.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions examples/chatserver/static/js/jquery.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions examples/chatserver/templates/broadcast_chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

{% block introduction %}
<p>Point a second browser onto this URL and check for message synchronization.</p>
<h1> WEBSOCKET_URI == {{ WEBSOCKET_URI }}</h1>
<h1> WS4REDIS_HEARTBEAT == {{ WS4REDIS_HEARTBEAT }}</h1>
{% endblock introduction %}

{% block script_panel %}
Expand All @@ -21,6 +23,7 @@
if (event.keyCode === 13) {
event.preventDefault();
ws4redis.send_message($('#text_message').val());
$("#text_message").val('')
}
});

Expand Down
14 changes: 10 additions & 4 deletions examples/chatserver/templates/chat_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Django Websocket Redis</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
{# <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">#}
<link href="{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet">
</head>

<body>
Expand Down Expand Up @@ -36,7 +37,9 @@
<ul class="nav navbar-nav navbar-right">
<li class="dropdown" style="margin-right: 12em;">
{% if request.user.is_authenticated %}
<a class="dropdown-toggle" href="#" data-toggle="dropdown">{{ request.user.get_full_name }} <span class="caret"></span></a>

<h1> {{ request.user.username }}</h1>
<a class="dropdown-toggle" href="#" data-toggle="dropdown">{{ request.user.username }} <span class="caret"></span></a>
<div class="dropdown-menu" style="padding:1em;">
<form class="form" action="{% url 'logout' %}" method="post">{% csrf_token %}
<input type="hidden" name="next" value="{{ request.get_full_path }}" />
Expand Down Expand Up @@ -92,8 +95,11 @@ <h1>Simple chat {% block "title" %}{% endblock %}</h1>
</div>
{% endblock main_content %}
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>

{# <script src="https://code.jquery.com/jquery-1.12.3.min.js" ></script>#}
{# <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>#}
<script src="{{ STATIC_URL }}js/jquery.min.js" type="text/javascript" ></script>
<script src="{{ STATIC_URL }}js/bootstrap.min.js" type="text/javascript" ></script>
<script src="{{ STATIC_URL }}js/ws4redis.js" type="text/javascript"></script>
{% block script_panel %}{% endblock %}
<a href="https://github.com/jrief/django-websocket-redis" class="hidden-xs">
Expand Down
1 change: 1 addition & 0 deletions examples/chatserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def dispatch(self, *args, **kwargs):
def post(self, request, *args, **kwargs):
redis_publisher = RedisPublisher(facility='foobar', users=[request.POST.get('user')])
message = RedisMessage(request.POST.get('message'))
print 'message == ', message
redis_publisher.publish_message(message)
return HttpResponse('OK')

Expand Down
1 change: 1 addition & 0 deletions zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
国内CDN线路问题, 因此将 example 前端的文件移到了本地运行。