I am fairly new to Turkey so a lot of the lingo will likely go over my head but I do have a pretty good understanding of the basics and naviagting around it (PuTTy command interface).
I am trying to setup Turnkey Django but I really don't like working within the pre-built project they provide. The obnoxiously long file names are a pain not to mention as soon as you want to add a package or update something you go through a whole chain of troubleshooting just to get it working again. It's more work than it's worth. Also many of the Django design rules are broken so it's full of mental gymnastics tryin to translate Django Documentation into the Turnkey Django solution. So all I want to do it setup my own Django Project so I can build it from the ground up with my own file names. However as soon as I touch the django.conf file it just throws 404. So I am here asking for a some guidence to get it to work outside of the pre-built Django project.
All my databases, dependencies, packages and Django files are in working order within a virtualenv.
Here is what I am using and the versions:
- PuTTy, SSH into the server (Windows 10 --SSH-> Linux)
- virtualenv, contains the Django project and several packages
- Django (2, 1, 6, 'final', 0)
- Python 3.6.8
- Turnkey GNU/Linux 9.6
sql_server.pyodbc
withODBC Driver 17 for SQL Server
for MSSQL
So when I change django.conf
in /root/etc/apache2/sites-available
from the defualt:
serverName localhost WSGIScriptAlias / /var/www/turnkey_project/turnkey_project/wsgi.py WSGIPythonPath /var/www/turnkey_project WSGIDaemonProcess django processes=1 threads=3 WSGIProcessGroup django <VirtualHost *:80> UseCanonicalName Off ServerAdmin webmaster@localhost DocumentRoot /var/www/turnkey_project/static </VirtualHost> <VirtualHost *:443> SSLEngine on ServerAdmin webmaster@localhost DocumentRoot /var/www/turnkey_project/static </VirtualHost> Alias /static /var/www/turnkey_project/static <Location "/static"> SetHandler None </Location> Alias /doc /usr/share/doc/python-django-doc/html <Location "/doc"> SetHandler None </Location>
To what I assumed would work with my own file paths but does not:
ServerName localhost WSGIScriptAlias / /var/www/sys/main/wsgi.py WSGIPythonPath /var/www/sys WSGIDaemonProcess django processes=1 threads=3 WSGIProcessGroup django <VirtualHost *:80> UseCanonicalName Off ServerAdmin webmaster@localhost DocumentRoot /var/www/sys/static </VirtualHost> <VirtualHost *:443> SSLEngine on ServerAdmin webmaster@localhost DocumentRoot /var/www/sys/static </VirtualHost> Alias /static /var/www/sys/static <Location "/static"> SetHandler None </Location> Alias /doc /var/www/sys/doc/html <Location "/doc"> SetHandler None </Location>
So why does it throw a 404 when I navigate to my IP? Am I setting it up wrong or is Turnkey just too restrictive? Everything seems to be in working order but it just does not want to work.
I have an app in my Django project and for those who are familiar with Django and it's URL patterns will know it will automatically change the url from foo.com/bar
to foo.com/bar/
(notice the suffixed '/'). When I "navigate" to my app it does apply this change automatically maybe suggesting Django is working properly but maybe my directories in my apache config isn't right or my file layout isn't correct (maybe).