diff options
| author | Bobby <[email protected]> | 2022-12-23 03:30:39 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-12-23 03:30:39 -0500 |
| commit | b63ba839fbf59cb8ff1bd7487ca50ffd2599ffe3 (patch) | |
| tree | ff630834834744710cfcb0abbfa53937a01613c2 | |
| parent | 033de51ad73b539ad5d56256659936471975f228 (diff) | |
| download | thatcomputerscientist-b63ba839fbf59cb8ff1bd7487ca50ffd2599ffe3.tar.xz thatcomputerscientist-b63ba839fbf59cb8ff1bd7487ca50ffd2599ffe3.zip | |
Use Cloudflare Tunnel for Local Development
| -rw-r--r-- | README.md | 20 | ||||
| -rw-r--r-- | thatcomputerscientist/settings.py | 6 |
2 files changed, 7 insertions, 19 deletions
@@ -11,32 +11,20 @@ Source Code for my Personal Website. - CSS Compatibility: [CSS2](https://www.w3.org/TR/CSS2/), [CSS3](https://www.w3.org/TR/CSS3/) ## Installation -Install [Python](https://www.python.org/downloads/) and [NodeJS](https://nodejs.org/en/download/) (if you want to use the local server). Then install requirements: +Install [Python](https://www.python.org/downloads/). Then install requirements: ```bash pip install -r requirements.txt ``` -Install localtunnel (will need to prefix with `sudo` on Linux and Mac): -```bash -npm install -g localtunnel -``` - ## Start the Server -> **Note**: This step uses [localtunnel](https://localtunnel.github.io/www/) to create a public URL for the server. This is only for development purposes. For production, use a proper web server like [Apache](https://httpd.apache.org/) or [Nginx](https://www.nginx.com/). Also, if you don't want to use the local tunnel, you can use the default Django server by running `python manage.py runserver`, but you will need to change the `CSRF_TRUSTED_ORIGINS`, `SESSION_COOKIE_DOMAIN`, and `DOMAIN_NAME` settings in `settings.py` accordingly. +> **Note**: You will need to change the `CSRF_TRUSTED_ORIGINS`, `SESSION_COOKIE_DOMAIN`, and `DOMAIN_NAME` settings in `settings.py` accordingly. -First, make the `runserver.sh` file executable: +To start the server, run: ```bash -chmod +x runserver.sh +python manage.py runserver ``` -Then, run the server: -```bash -./runserver.sh -``` - -This will start the server which will be accessible at [https://thatcomputerscientist.loca.lt](https://thatcomputerscientist.loca.lt) (use `http` on older browsers). To stop the server, press `Ctrl+C`. The server will automatically restart when changes are made to the source code. - <!-- Footnotes --> #### Footnotes diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py index bcbbd181..e7edc803 100644 --- a/thatcomputerscientist/settings.py +++ b/thatcomputerscientist/settings.py @@ -32,9 +32,9 @@ DEBUG = True # if os.getenv('ENVIRONMENT') == 'development' else False ALLOWED_HOSTS = ["*"] -CSRF_TRUSTED_ORIGINS = ['https://*.thatcomputerscientist.loca.lt', 'https://*.thatcomputerscientist.com', 'http://*.thatcomputerscientist.com'] -SESSION_COOKIE_DOMAIN = "thatcomputerscientist.loca.lt" if os.getenv('ENVIRONMENT') == 'development' else ".thatcomputerscientist.com" -DOMAIN_NAME = "thatcomputerscientist.loca.lt" if os.getenv('ENVIRONMENT') == 'development' else "thatcomputerscientist.com" +CSRF_TRUSTED_ORIGINS = ['https://*.thatcomputerscientist.com', 'http://*.thatcomputerscientist.com'] +SESSION_COOKIE_DOMAIN = ".thatcomputerscientist.com" +DOMAIN_NAME = "thatcomputerscientist.com" # Application definition |
