I have created web site with django, db.sqlite3. I have static files. I would like to access my web site externally. I would like to set my PC as a web server and access my web site outside from my local network. Could you please advice how to do that?
Assuming you just want to test the site on a different device or show it to someone else, you can use something like ngrok. Don’t leave it running permanently, And don’t run the django app in debug mode!
If you just want to deploy your site to the web with minimum effort, use a PaaS like Heroku.
There are many other ways to do this, and lots of things to watch for. Can you give more info about what you want to achieve?
For quick exposure to showcase things to someone outside prolly the safest quick method would be to use an ssh-tunnel. This can easily be set up under linux or macos, no clue how to do that under windows though. Schematically:
open portXY on your network gateway (your ISP box) and create a route to your machine:22
adjust firewall and start ssh server on your machine on port 22
create a highly restricted custom user for the remote login (ideally without login shell)
request ssh pubkey from the remote user and put it in /home/.ssh/authorized_keys
run django app with DEBUG=False
now the remote user can access the django app by doing these steps:
Warning: This is only meant for a short quick access. The other person should be 100% trustworthy, as he logs directly into your machine to establish the tunnel.
When done, dont forget to:
disable/remove custom user from your machine
stop ssh server and adjust firewall
delete route and close port on ISP box
So yeah this is already quite involved, but still alot quicker than preparing your machine for proper external web access. If you have to do that more often, you really should consider a proper webserver stack.
i started to configure gunicorn /etc/systemd/system/gunicorn.service and /etc/systemd/system/gunicorn.socket but on MACOS there is no such a folder systemd. Could you please help to configure gunicorn on MACOS?
Here is the link where I started the configuration:
They mention this tutorial by digital ocean in the one you’ve linked. I recommend giving that one a read and if $10 for a droplet is an option, try it out on digital ocean.
On my local machine the web site is working but I would like to make it accessible outside from my local network. Therefore I need this configuration on MACOS!
Depending upon how you are connected to the internet, you may need to configure your ISP connection to provide port-forwarding to your Mac. (You may also want to configure your network such that your Mac has a static IP address and not DHCP.) You will then be providing your “public-facing” ip address to the people who will be accessing it.