{{ post.title }}
+{{ post.description }}
+ Read More +From d54d129af4388d73f015102aa39e1c1cc298ac3f Mon Sep 17 00:00:00 2001 From: winter_x64 <75623356+winter-x64@users.noreply.github.com> Date: Tue, 25 Feb 2025 12:54:10 +0530 Subject: [PATCH] Project setup --- .vscode/extensions.json | 8 ++ .vscode/settings.json | 36 ++++++ main.py | 6 +- nano/__init__.py | 11 ++ nano/blog/dashboard.py | 3 + nano/home/home.py | 31 +++++ nano/static/css/home/home.css | 212 +++++++++++++++++++++++++++++++ nano/templates/landing_page.html | 89 +++++++++++++ 8 files changed, 393 insertions(+), 3 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 nano/__init__.py create mode 100644 nano/blog/dashboard.py create mode 100644 nano/home/home.py create mode 100644 nano/static/css/home/home.css create mode 100644 nano/templates/landing_page.html diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..110c63d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "ms-python.python", + "ms-python.vscode-pylance", + "charliermarsh.ruff", + "esbenp.prettier-vscode" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1ad743a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,36 @@ +{ + "python.analysis.inlayHints.functionReturnTypes": true, + "python.analysis.inlayHints.variableTypes": true, + "python.analysis.inlayHints.callArgumentNames": "partial", + "python.analysis.autoImportCompletions": true, + "python.analysis.fixAll": [ + "source.unusedImports" + ], + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "always", + "source.unusedImports": "explicit" + }, + "editor.defaultFormatter": "charliermarsh.ruff" + }, + "python.terminal.activateEnvInCurrentTerminal": true, + "python.terminal.focusAfterLaunch": true, + "python.createEnvironment.contentButton": "show", + "diffEditor.wordWrap": "on", + "editor.wordWrap": "on", + "explorer.autoRevealExclude": { + "/env": true, + "/venv": true, + "/.venv": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "ruff.organizeImports": true, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "editor.fontLigatures": true, + "editor.formatOnType": true, + "editor.guides.bracketPairs": "active" +} \ No newline at end of file diff --git a/main.py b/main.py index 37c86a8..7c196b0 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ -def main(): - print("Hello from nanoblog!") +from nano import nano_blog +app = nano_blog() if __name__ == "__main__": - main() + app.run(debug=True) diff --git a/nano/__init__.py b/nano/__init__.py new file mode 100644 index 0000000..27d5a39 --- /dev/null +++ b/nano/__init__.py @@ -0,0 +1,11 @@ +from flask import Flask + + +def nano_blog(): + app = Flask(__name__) + + from .home.home import home_bp + + app.register_blueprint(blueprint=home_bp) + + return app diff --git a/nano/blog/dashboard.py b/nano/blog/dashboard.py new file mode 100644 index 0000000..a20bec2 --- /dev/null +++ b/nano/blog/dashboard.py @@ -0,0 +1,3 @@ +from flask import Blueprint + +dashboard_bp = Blueprint(name="home_bp", import_name=__name__, url_prefix="/blog") diff --git a/nano/home/home.py b/nano/home/home.py new file mode 100644 index 0000000..af531e4 --- /dev/null +++ b/nano/home/home.py @@ -0,0 +1,31 @@ +from flask import Blueprint, render_template + +home_bp = Blueprint(name="home_bp", import_name=__name__, url_prefix="/") + +featured_posts = [ + { + "title": "Understanding Quantum Computing in Simple Terms", + "description": "A brief introduction to quantum computing and its potential impact.", + "image": "https://via.placeholder.com/350x250", + "link": "#", + }, + { + "title": "The Future of Artificial Intelligence", + "description": "Exploring the next big breakthroughs in AI technology.", + "image": "https://via.placeholder.com/350x250", + "link": "#", + }, + { + "title": "How Minimalism Can Improve Your Life", + "description": "Discover the power of living with less and its benefits for your mental health.", + "image": "https://via.placeholder.com/350x250", + "link": "#", + }, +] + + +@home_bp.route(rule="/") +def home(): + return render_template( + template_name_or_list="landing_page.html", featured_posts=featured_posts + ) diff --git a/nano/static/css/home/home.css b/nano/static/css/home/home.css new file mode 100644 index 0000000..5197146 --- /dev/null +++ b/nano/static/css/home/home.css @@ -0,0 +1,212 @@ +/* Reset */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + color: #333; + padding: 20px; + text-align: center; +} + +header { + margin-bottom: 40px; +} + +header h1 { + font-size: 40px; + color: #2c3e50; +} + +header p { + font-size: 18px; + color: #7f8c8d; +} + +.posts { + margin: 0 auto; + max-width: 600px; +} + +.posts h2 { + font-size: 30px; + margin-bottom: 20px; +} + +.post-list { + display: flex; + flex-direction: column; + gap: 20px; +} + +article { + background-color: white; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +article h3 { + font-size: 22px; + margin-bottom: 10px; +} + +article p { + font-size: 16px; + margin-bottom: 15px; +} + +article a { + font-size: 16px; + color: #e74c3c; + text-decoration: none; +} + +article a:hover { + text-decoration: underline; +} + +footer { + margin-top: 40px; + font-size: 14px; + color: #7f8c8d; +} + +/* General Reset */ +/* * { + margin: 0; + padding: 0; + box-sizing: border-box; +} */ + +/* Body */ +/* body { + font-family: Arial, sans-serif; + line-height: 1.6; +} */ + +/* Header */ +/* header { + background: #2c3e50; + color: white; + padding: 20px 0; + text-align: center; +} + +.navbar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 20px; +} + +.logo { + font-size: 30px; + font-weight: bold; +} + +nav ul { + list-style: none; +} + +nav ul li { + display: inline; + margin: 0 15px; +} + +nav ul li a { + color: white; + text-decoration: none; +} + +.hero-section { + margin-top: 40px; +} + +.hero-section h2 { + font-size: 50px; + margin-bottom: 10px; +} + +.hero-section p { + font-size: 20px; + margin-bottom: 20px; +} + +.cta-button { + background-color: #e74c3c; + padding: 12px 25px; + color: white; + font-size: 18px; + text-decoration: none; + border-radius: 5px; +} + +.cta-button:hover { + background-color: #c0392b; +} */ + +/* Featured Posts Section */ +/* .featured-posts { + background-color: #ecf0f1; + padding: 40px 0; + text-align: center; +} + +.featured-posts h3 { + font-size: 36px; + margin-bottom: 20px; +} + +.posts-container { + display: flex; + justify-content: space-around; + flex-wrap: wrap; +} + +.post { + background-color: white; + width: 300px; + margin: 15px; + padding: 20px; + border-radius: 10px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + text-align: center; +} + +.post img { + width: 100%; + border-radius: 10px; +} + +.post h4 { + margin-top: 15px; + font-size: 22px; +} + +.post p { + margin: 10px 0; + font-size: 16px; +} + +.post a { + color: #e74c3c; + text-decoration: none; +} + +.post a:hover { + text-decoration: underline; +} */ + +/* Footer */ +/* footer { + background-color: #34495e; + color: white; + text-align: center; + padding: 20px 0; + margin-top: 50px; +} */ diff --git a/nano/templates/landing_page.html b/nano/templates/landing_page.html new file mode 100644 index 0000000..7dba7ed --- /dev/null +++ b/nano/templates/landing_page.html @@ -0,0 +1,89 @@ + + +
+ + +Your source for bite-sized knowledge.
+{{ post.description }}
+ Read More +