Name | Flask-Embed JSON |
Version |
0.0.1
JSON |
| download |
home_page | None |
Summary | A Flask extension for embedding python code directly in HTML templates. |
upload_time | 2025-01-18 21:21:00 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License Copyright (c) 2025 Jaton Justice Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
flask
embed
jinja
extension
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Flask-Embed Project 🚀🐍
![Flask-Embed Logo](https://raw.githubusercontent.com/Masterjx9/Flask-Embed/main/logo.png)
Flask-Embed is a Flask extension that allows you to run Python code directly from your HTML templates. This can be incredibly useful for convience of running python from the HTML templates as a convience. 🎉
## Installation 📦
You can install Flask-Embed using pip:
```sh
pip install Flask-Embed
```
## Usage Example 💻
Here's a simple example of how to use Flask with the Flask-Embed library:
```python
from flask import Flask
from flask_embed import Embed
app = Flask(__name__)
embed = Embed()
@app.route('/')
def hello_world():
return embed.render_template('index.html', embed=embed)
if __name__ == '__main__':
app.run(debug=True)
```
## How It Works 🛠️
Flask-Embed allows you to embed Python code within your HTML templates using special tags. The embedded Python code is executed on the server side, and the output is rendered in the HTML.
### Example HTML Template 📄
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reactive Flask</title>
</head>
<body>
<h1>Python Embed Test</h1>
<p>Python code:</p>
<FlaskOutput></FlaskOutput>
</body>
</html>
```
### Embedded Python Code 🐍
```python
<Flask>
import urllib.request
import json
with urllib.request.urlopen("https://jsonplaceholder.typicode.com/posts") as response:
data = response.read()
posts = json.loads(data)
output = posts[:5]
</Flask>
```
The above code fetches data from an API and displays the first five posts in the HTML template. 🌐
## Conclusion 🎯
Flask-Embed makes it easy to integrate Python code into your HTML templates, providing a seamless way to create dynamic web applications. Give it a try and see how it can simplify your Flask projects! 🚀
Raw data
{
"_id": null,
"home_page": null,
"name": "Flask-Embed",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "flask, embed, jinja, extension",
"author": null,
"author_email": "Jaton Justice <jaton@pythonicit.com>",
"download_url": "https://files.pythonhosted.org/packages/cb/09/3691055fe84e0ba06c681b69b7a5be3ca72fbe2e488284e3d7577d4b6c35/flask_embed-0.0.1.tar.gz",
"platform": null,
"description": "# Flask-Embed Project \ud83d\ude80\ud83d\udc0d\r\n\r\n![Flask-Embed Logo](https://raw.githubusercontent.com/Masterjx9/Flask-Embed/main/logo.png)\r\n\r\nFlask-Embed is a Flask extension that allows you to run Python code directly from your HTML templates. This can be incredibly useful for convience of running python from the HTML templates as a convience. \ud83c\udf89\r\n\r\n## Installation \ud83d\udce6\r\n\r\nYou can install Flask-Embed using pip:\r\n\r\n```sh\r\npip install Flask-Embed\r\n```\r\n\r\n## Usage Example \ud83d\udcbb\r\n\r\nHere's a simple example of how to use Flask with the Flask-Embed library:\r\n\r\n```python\r\nfrom flask import Flask\r\nfrom flask_embed import Embed\r\n\r\napp = Flask(__name__)\r\nembed = Embed()\r\n\r\n@app.route('/')\r\ndef hello_world():\r\n return embed.render_template('index.html', embed=embed)\r\n\r\nif __name__ == '__main__':\r\n app.run(debug=True)\r\n```\r\n\r\n## How It Works \ud83d\udee0\ufe0f\r\n\r\nFlask-Embed allows you to embed Python code within your HTML templates using special tags. The embedded Python code is executed on the server side, and the output is rendered in the HTML.\r\n\r\n### Example HTML Template \ud83d\udcc4\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>Reactive Flask</title>\r\n</head>\r\n<body>\r\n <h1>Python Embed Test</h1>\r\n <p>Python code:</p>\r\n <FlaskOutput></FlaskOutput>\r\n</body>\r\n</html>\r\n```\r\n\r\n### Embedded Python Code \ud83d\udc0d\r\n\r\n```python\r\n<Flask>\r\nimport urllib.request\r\nimport json\r\n\r\nwith urllib.request.urlopen(\"https://jsonplaceholder.typicode.com/posts\") as response:\r\n data = response.read()\r\n posts = json.loads(data)\r\n output = posts[:5]\r\n</Flask>\r\n```\r\n\r\nThe above code fetches data from an API and displays the first five posts in the HTML template. \ud83c\udf10\r\n\r\n## Conclusion \ud83c\udfaf\r\n\r\nFlask-Embed makes it easy to integrate Python code into your HTML templates, providing a seamless way to create dynamic web applications. Give it a try and see how it can simplify your Flask projects! \ud83d\ude80\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2025 Jaton Justice Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "A Flask extension for embedding python code directly in HTML templates.",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/Masterjx9/Flask-Embed",
"Source": "https://github.com/Masterjx9/Flask-Embed",
"Tracker": "https://github.com/yourusername/flask-embed/issues"
},
"split_keywords": [
"flask",
" embed",
" jinja",
" extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "967122705539926fefb7bbc2f2955deb47de6a18293087aefd5b867706b278b5",
"md5": "b7769ce90315845f869c7cfa39409abb",
"sha256": "5bd38435b4bb85b18fb3d6712d6335059665291d526ab4480e7d31f01a4ed49b"
},
"downloads": -1,
"filename": "Flask_Embed-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b7769ce90315845f869c7cfa39409abb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5071,
"upload_time": "2025-01-18T21:20:59",
"upload_time_iso_8601": "2025-01-18T21:20:59.081345Z",
"url": "https://files.pythonhosted.org/packages/96/71/22705539926fefb7bbc2f2955deb47de6a18293087aefd5b867706b278b5/Flask_Embed-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cb093691055fe84e0ba06c681b69b7a5be3ca72fbe2e488284e3d7577d4b6c35",
"md5": "b2baffe960f61aa732da5ff2efb37864",
"sha256": "21d4ba60631a940c643b2642d46bcb24bf6d6d9597ffd4dadae0e95c5dc0fe51"
},
"downloads": -1,
"filename": "flask_embed-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b2baffe960f61aa732da5ff2efb37864",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4244,
"upload_time": "2025-01-18T21:21:00",
"upload_time_iso_8601": "2025-01-18T21:21:00.919138Z",
"url": "https://files.pythonhosted.org/packages/cb/09/3691055fe84e0ba06c681b69b7a5be3ca72fbe2e488284e3d7577d4b6c35/flask_embed-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-18 21:21:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Masterjx9",
"github_project": "Flask-Embed",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flask-embed"
}