Add gunicorn production server
This commit is contained in:
+2
-2
@@ -22,5 +22,5 @@ COPY . .
|
|||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
ENTRYPOINT [ "python" ]
|
ENTRYPOINT [ "gunicorn" ]
|
||||||
CMD [ "portable.py" ]
|
CMD [ "portable:app" ]
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ It pretends to be GoogleBot (Google's web crawler) and gets the same content tha
|
|||||||
### Using Docker
|
### Using Docker
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- docker
|
- docker
|
||||||
- Docker Compose (available as `docker compose`)
|
- Docker Compose (available as `docker compose`)
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ If that doesn't work retry but replace `python` with `py`, then try `python3`, t
|
|||||||
Then run `portable.py`, click [this link](https://realpython.com/run-python-scripts/) for a tutorial on how to run python scripts.
|
Then run `portable.py`, click [this link](https://realpython.com/run-python-scripts/) for a tutorial on how to run python scripts.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python portable.py
|
python -m gunicorn 'portable:app'
|
||||||
```
|
```
|
||||||
|
|
||||||
Then open the link shown in the terminal in the browser and you'll be able to use this
|
Then open the link shown in the terminal in the browser and you'll be able to use this
|
||||||
@@ -58,26 +59,29 @@ python -m pip install -r requirements.txt
|
|||||||
FLASK_APP=app/portable.py flask run --host=127.0.0.1 --port=9982
|
FLASK_APP=app/portable.py flask run --host=127.0.0.1 --port=9982
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Using as a Bookmarklet in Chrome:
|
## Using as a Bookmarklet in Chrome:
|
||||||
|
|
||||||
You can create a bookmarklet that performs the URL transformation by writing a small JavaScript snippet. Below is the JavaScript code for your bookmarklet:
|
You can create a bookmarklet that performs the URL transformation by writing a small JavaScript snippet. Below is the JavaScript code for your bookmarklet:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
javascript:(function(){window.location.href='https://13ft.wasimaster.me/'+encodeURIComponent(window.location.href);})();
|
javascript: (function () {
|
||||||
|
window.location.href =
|
||||||
|
"https://13ft.wasimaster.me/" + encodeURIComponent(window.location.href);
|
||||||
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
You can replace https://13ft.wasimaster.me with your own 13ft instance if desired.
|
You can replace https://13ft.wasimaster.me with your own 13ft instance if desired.
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
|
|
||||||
1. Open Bookmarks Manager:
|
1. Open Bookmarks Manager:
|
||||||
|
|
||||||
2. Click on the three dots (menu) in the top-right corner of Chrome.
|
2. Click on the three dots (menu) in the top-right corner of Chrome.
|
||||||
Go to Bookmarks > Bookmark manager, or simply press Ctrl+Shift+O on Windows/Linux or Cmd+Option+B on Mac.
|
Go to Bookmarks > Bookmark manager, or simply press Ctrl+Shift+O on Windows/Linux or Cmd+Option+B on Mac.
|
||||||
Create a New Bookmark:
|
Create a New Bookmark:
|
||||||
|
|
||||||
3. In the Bookmark Manager, click the three-dot menu in the top-right corner of the window and select Add new bookmark.
|
3. In the Bookmark Manager, click the three-dot menu in the top-right corner of the window and select Add new bookmark.
|
||||||
Enter Bookmark Details:
|
Enter Bookmark Details: - Name: Enter a name for your bookmarklet, such as "13ft-ize". This name will show as a bookmark title in the bookmarks bar - URL: Paste the JavaScript code provided above into the URL field.
|
||||||
- Name: Enter a name for your bookmarklet, such as "13ft-ize". This name will show as a bookmark title in the bookmarks bar
|
|
||||||
- URL: Paste the JavaScript code provided above into the URL field.
|
|
||||||
4. Click Save.
|
4. Click Save.
|
||||||
|
|
||||||
Using the Bookmarklet:
|
Using the Bookmarklet:
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
from os import environ
|
||||||
|
|
||||||
|
# https://docs.gunicorn.org/en/stable/settings.html#settings
|
||||||
|
bind = f"0.0.0.0:{environ.get('PORT', 5000)}"
|
||||||
+2
-1
@@ -260,4 +260,5 @@ def get_article(path):
|
|||||||
return "Invalid URL", 400
|
return "Invalid URL", 400
|
||||||
|
|
||||||
|
|
||||||
app.run(host="0.0.0.0", port=5000, debug=False)
|
if __name__ == "__main__":
|
||||||
|
app.run(host="0.0.0.0", port=5000, debug=False)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
flask
|
|
||||||
requests
|
|
||||||
bs4
|
bs4
|
||||||
|
flask
|
||||||
|
gunicorn
|
||||||
|
requests
|
||||||
|
|||||||
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
flask
|
|
||||||
requests
|
|
||||||
bs4
|
bs4
|
||||||
|
flask
|
||||||
|
gunicorn
|
||||||
|
requests
|
||||||
|
|||||||
Reference in New Issue
Block a user