> On 14 Dec 2019, at 11:51 am, js <[email protected]> wrote:
> 
> hey im launching a website for school project. i could just use a refresher 
> on the best way to set up a stable website. ive done this before but im not 
> entirely clear from the docs at 
> https://modwsgi.readthedocs.io/en/develop/index.html
> 
> Im running ubuntu 18 x64 on digital ocean, i installed apache2 and mysql.  i 
> set up a django project at /var/www/djang0 . i set up a python3 venv here. i 
> pip3 installed 
> 
> django django-ckeditor django-safedelete mock mod-wsgi pillow
> 
> I believe i need some redirect for my site to force SSL.
> 
> Here are previous config files.  the doc says i dont necesarrily have to 
> manually set up apache conf files, but Im skeptical (due to ssl redirect and 
> my domain)
> 
> 1.  could you advice on best way to configure this to serve my django web app 
> for a longer term stable website? note since python deprecated the venv 
> command,

Not sure if you are misinterpreting things.

Deprecated since version 3.6: pyvenv was the recommended tool for creating 
virtual environments for Python 3.3 and 3.4, and is deprecated in Python 3.6 
<https://docs.python.org/dev/whatsnew/3.6.html#deprecated-features>.

Changed in version 3.5: The use of venv is now recommended for creating virtual 
environments.

The env command wasn't deprecated. The pyvenv command was.

You can still use:

    python -m venv

> there is no venv folder, 
> there is bin, lib, share folders and a pyvenv.cfg file.  so would i change 
> the daemon process path to ' python-home=/var/www/djang0/bin '  ?
> 
> 2.   do i need to load a wsgi file? add the confs to 
> /etc/apache2/sites-available, then a2enmod djang0 to enable. run cerbot for 
> ssl after this to apply the ssl configuration?  many thanks

These are all things I can't help with as they are specific to your Linux 
distribution as to how they are handled.

In general, I would suggest making sure you read:

https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html 
<https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html>

and watch:

https://www.youtube.com/watch?v=CPz0s1CQsTE 
<https://www.youtube.com/watch?v=CPz0s1CQsTE>

Graham

> 
>     # OLD WORKING vhosts for django project djang0  
> 
>  
> # sudo nano /etc/apache2/sites-available/djang0.conf
> 
> <VirtualHost *:80>
>                 ServerName skylinedev.net
>                 ServerAlias www.skylinedev.net
>                 #Redirect permanent / https://www.skylinedev.net/
>                 WSGIDaemonProcess djang0 python-home=/var/www/djang0/venv 
> python-path=/var/www/djang0/djang0 user=sldadmin group=www-data processes=2 
> threads=5
>                 WSGIProcessGroup djang0
>                 WSGIApplicationGroup %{GLOBAL}
>                 WSGIScriptAlias / /var/www/djang0/djang0/djang0/wsgi.py
>                 <Directory /var/www/djang0/djang0/djang0/>
>                 <Files wsgi.py>
>                         Order allow,deny
>                         Allow from all
>                 </Files>
>                 </Directory>
> 
>                 Alias /static /var/www/djang0/djang0/static
>                 <Directory /var/www/djang0/djang0/static>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
> 
>                 Alias /robots.txt /var/www/djang0/djang0/static/robots.txt
>                 Alias /favicon.ico /var/www/djang0/djang0/static/favicon.ico
> 
>                 Alias /media /var/www/djang0/djang0/media
>                 <Directory /var/www/djang0/djang0/media>
>                         Order allow,deny
>                         Allow from all
>                 </Directory>
> 
>                 ErrorLog /var/www/djang0/logs/a2/error.log
>                 LogLevel warn
>                 CustomLog /var/www/djang0/logs/a2/access.log combined
> 
> RewriteEngine on
> RewriteCond %{SERVER_NAME} =www.skylinedev.net [OR]
> RewriteCond %{SERVER_NAME} =skylinedev.net
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
> </VirtualHost>
> 
> 
> 
> # sudo nano /etc/apache2/sites-available/000-default-le-ssl.conf 
> 
> <IfModule mod_ssl.c>
> <VirtualHost *:443>
>         # The ServerName directive sets the request scheme, hostname and port 
> that
>         # the server uses to identify itself. This is used when creating
>         # redirection URLs. In the context of virtual hosts, the ServerName
>         # specifies what hostname must appear in the request's Host: header to
>         # match this virtual host. For the default virtual host (this file) 
> this
>         # value is not decisive as it is used as a last resort host 
> regardless.
>         # However, you must set it for any further virtual host explicitly.
>         #ServerName www.example.com
> 
>         #ServerAdmin webmaster@localhost
>         #DocumentRoot /var/www/html
> 
>         WSGIProcessGroup djang0
>         WSGIApplicationGroup %{GLOBAL}
>         WSGIScriptAlias / /var/www/djang0/djang0/djang0/wsgi.py
>         <Directory /var/www/djang0/djang0/djang0/>
>         <Files wsgi.py>
>                 Order allow,deny
>                 Allow from all
>         </Files>
>         </Directory>
> 
>         Alias /static /var/www/djang0/djang0/static
>         <Directory /var/www/djang0/djang0/static>
>                 Order allow,deny
>                 Allow from all
>         </Directory>
> 
>         Alias /robots.txt /var/www/djang0/djang0/static/robots.txt
>         Alias /favicon.ico /var/www/djang0/djang0/static/favicon.ico
> 
>         Alias /media /var/www/djang0/djang0/media
>         <Directory /var/www/djang0/djang0/media>
>                 Order allow,deny
>                 Allow from all
>         </Directory>
> 
>         ErrorLog /var/www/djang0/logs/ssl/error.log
>         LogLevel warn
>         CustomLog /var/www/djang0/logs/ssl/access.log combined
>         
>         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
>         # error, crit, alert, emerg.
>         # It is also possible to configure the loglevel for particular
>         # modules, e.g.
>         #LogLevel info ssl:warn
> 
>         #ErrorLog ${APACHE_LOG_DIR}/error.log
>         #CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
>         # For most configuration files from conf-available/, which are
>         # enabled or disabled at a global level, it is possible to
>         # include a line for only one particular virtual host. For example the
>         # following line enables the CGI configuration for this host only
>         # after it has been globally disabled with "a2disconf".
>         #Include conf-available/serve-cgi-bin.conf
> SSLCertificateFile /etc/letsencrypt/live/skylinedev.net/fullchain.pem
> SSLCertificateKeyFile /etc/letsencrypt/live/skylinedev.net/privkey.pem
> Include /etc/letsencrypt/options-ssl-apache.conf
> ServerName skylinedev.net
> ServerAlias www.skylinedev.net
> </VirtualHost>
>                 
> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
> </IfModule>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/5736fe78-3515-4b3a-953a-1a440831584c%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/5736fe78-3515-4b3a-953a-1a440831584c%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/70B3BE84-B15D-4CF4-A47E-B97553765D9B%40gmail.com.

Reply via email to