Compare commits

...

5 Commits

Author SHA1 Message Date
Gesche 3247bafdd8 add uwsgi config 2019-02-10 14:18:30 +01:00
Gesche 6c1c60ae51 redirect from / to /accounts/ 2019-02-10 14:17:56 +01:00
Gesche 2a2b841cc0 allow hosting anywhere 2019-02-10 14:17:36 +01:00
Gesche 13c259cc60 password as password field in form 2019-02-10 14:17:26 +01:00
Gesche 84fc9f9570 add getting started page 2019-02-10 14:17:02 +01:00
8 changed files with 84 additions and 1 deletions

View File

@ -39,6 +39,7 @@
<li><a href="{% url 'accounts:index' %}">Home</a></li> <li><a href="{% url 'accounts:index' %}">Home</a></li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li><a href="{% url 'accounts:characters' %}">My characters</a></li> <li><a href="{% url 'accounts:characters' %}">My characters</a></li>
<li><a href="{% url 'accounts:getting_started' %}">Getting started</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,31 @@
{% extends "base_generic.html" %}
{% block content %}
<h2 class="tibia-headline">Getting Started</h2>
{% if user.is_authenticated %}
<p>
Beside this account you need a client to connect to the server.
Get the client source from here:
<a href="https://git.someserver.de/gesche/tibia-client">https://git.someserver.de/gesche/tibia-client</a>
</p>
<p>Follow the instructions there to compile, in general for linux systems with apt you need to install the requirements:</p>
sudo apt-get install -y build-essential cmake git-core <br>
sudo apt-get install -y libboost-all-dev libphysfs-dev libssl1.0-dev liblua5.1-0-dev <br>
sudo apt-get install -y libglew-dev libvorbis-dev libopenal-dev zlib1g-dev <br>
<br>
<p>And build with:</p>
git clone https://git.someserver.de/gesche/tibia-client.git <br>
cd otclient && mkdir build && cd build && cmake -DUSE_STATIC_LIBS=OFF .. && make <br>
./otclient <br>
<br>
<p>Finally, the client needs some files that contain the graphics and other static stuff for the server.
Ask Gesche how to obtain them.</p>
{% else %}
Please log in to view this information.
{% endif %}
{% endblock %}

View File

@ -2,6 +2,7 @@ from django.urls import path
from . import views from . import views
from django.views.generic import TemplateView
app_name = 'accounts' app_name = 'accounts'
@ -10,4 +11,5 @@ urlpatterns = [
path('register/', views.RegisterAccountView.as_view(), name='register'), path('register/', views.RegisterAccountView.as_view(), name='register'),
path('characters/', views.PlayerView.as_view(), name='characters'), path('characters/', views.PlayerView.as_view(), name='characters'),
path('create_character/', views.CreateCharView.as_view(), name='create_char'), path('create_character/', views.CreateCharView.as_view(), name='create_char'),
path('getting_started/', TemplateView.as_view(template_name='getting_started.html'), name='getting_started'),
] ]

View File

@ -16,6 +16,11 @@ class RegisterAccountView(CreateView):
fields = ['name', 'password', 'email'] fields = ['name', 'password', 'email']
template_name = 'register_account.html' template_name = 'register_account.html'
def get_form(self, form_class=None):
form = super(RegisterAccountView, self).get_form(form_class)
form.fields['password'].widget = forms.PasswordInput()
return form
def form_valid(self, form): def form_valid(self, form):
self.object = form.save(commit=False) self.object = form.save(commit=False)

25
tibia_uwsgi.ini Normal file
View File

@ -0,0 +1,25 @@
# tibia_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/gesche/coding/tibia-website/tibia_website/
# Django's wsgi file
module = tibia_website.wsgi
# the virtualenv (full path)
home = /home/gesche/coding/virtual-envs/tibia-env
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /home/gesche/tibia.sock
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
plugin = python3

View File

@ -25,7 +25,7 @@ SECRET_KEY = '0bup5^j9qen7!g8i5ngkc0_n+0wh@8n8j@_j+$vj06l3v2)esl'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = ['*']
# Application definition # Application definition
@ -123,6 +123,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.1/howto/static-files/ # https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
# Redirect to home URL after login (Default redirects to /accounts/profile/) # Redirect to home URL after login (Default redirects to /accounts/profile/)
LOGIN_REDIRECT_URL = '/accounts/' LOGIN_REDIRECT_URL = '/accounts/'

View File

@ -15,9 +15,11 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
from django.views.generic import RedirectView
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', RedirectView.as_view(url='/accounts/')),
path('accounts/', include('accounts.urls')), path('accounts/', include('accounts.urls')),
path('auth/', include('django.contrib.auth.urls')), path('auth/', include('django.contrib.auth.urls')),
] ]

16
uwsgi_params Normal file
View File

@ -0,0 +1,16 @@
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;