diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/Basic Blogging Platform/README.md b/Basic Blogging Platform/README.md new file mode 100644 index 0000000..c9c8a8c --- /dev/null +++ b/Basic Blogging Platform/README.md @@ -0,0 +1,44 @@ +# Simple Blogging Platform + +A basic blogging platform created using Python, allowing users to create, edit, and view blog posts. + +## Table of Contents +- [Features](#features) +- [Usage](#usage) +- [Enhanced CSS](#enhanced-css) + +--- + +## Features + +- Users can create and edit blog posts. +- Posts are displayed with a title and content. +- Smooth transitions and improved CSS for a better user experience. +- Responsive design. + +## Usage + +1. Browse existing blog posts on the main page. +2. Click on "Create a new post" to add a new blog post. +3. Enter a title and content for your post, then click "Create Post." +4. Your new post will be displayed on the main page. +5. Click on any post to view its details or edit it. + +## Enhanced CSS + +The CSS has been enhanced to provide smooth transitions, improved background color, and better alignment for a more visually pleasing user experience. + +### Features of Enhanced CSS + +- Smooth transitions for elements. +- Improved background color. +- Enhanced alignment of text content. +- Responsive design. + +Feel free to further customize the CSS to match your desired design. + +--- + +## Developed By +Eshaalakshmi D S : https://github.com/EshaalakshmiDS + diff --git a/Basic Blogging Platform/app.py b/Basic Blogging Platform/app.py new file mode 100644 index 0000000..23cfed9 --- /dev/null +++ b/Basic Blogging Platform/app.py @@ -0,0 +1,56 @@ +import http.server +import socketserver +from urllib.parse import parse_qs, urlparse + +# Store blog posts in a list (in-memory storage, not suitable for production) +posts = [] + +class BlogHandler(http.server.SimpleHTTPRequestHandler): + def do_GET(self): + if self.path == '/': + self.send_response(200) + self.send_header('Content-type', 'text/html') + self.end_headers() + self.wfile.write(b'Welcome to My Blog\n') + self.wfile.write(b'\n') + self.wfile.write(b'Create a new post\n') + elif self.path == '/create': + self.send_response(200) + self.send_header('Content-type', 'text/html') + self.end_headers() + self.wfile.write(b'Create a New Blog Post\n') + self.wfile.write(b'
\n') + self.wfile.write(b'\n') + self.wfile.write(b'
\n') + self.wfile.write(b'\n') + self.wfile.write(b'
\n') + self.wfile.write(b'\n') + self.wfile.write(b'
\n') + else: + self.send_response(404) + self.end_headers() + self.wfile.write(b'Not Found') + + def do_POST(self): + content_length = int(self.headers['Content-Length']) + post_data = self.rfile.read(content_length).decode('utf-8') + post_params = parse_qs(post_data) + title = post_params['title'][0] + content = post_params['content'][0] + posts.append({'title': title, 'content': content}) + self.send_response(303) + self.send_header('Location', '/') + self.end_headers() + +if __name__ == '__main__': + PORT = 8080 + + with socketserver.TCPServer(("", PORT), BlogHandler) as httpd: + print(f"Serving at port {PORT}") + httpd.serve_forever() diff --git a/Basic Blogging Platform/css/style.css b/Basic Blogging Platform/css/style.css new file mode 100644 index 0000000..5ca0b30 --- /dev/null +++ b/Basic Blogging Platform/css/style.css @@ -0,0 +1,67 @@ +body { + font-family: Arial, sans-serif; + background: linear-gradient(to bottom, #f0f0f0, #e0e0e0); + margin: 0; + padding: 0; +} + +h1 { + text-align: center; + background-color: #007acc; + color: white; + padding: 20px; + margin: 0; +} + +ul { + list-style-type: none; + padding: 0; + text-align: center; +} + +li { + background-color: #fff; + border: 1px solid #ddd; + border-radius: 5px; + margin: 10px; + padding: 20px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s; + cursor: pointer; +} + +li:hover { + transform: scale(1.05); + box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2); + background-color: #f5f5f5; /* Lighter background color on hover */ +} + +h2 { + font-size: 24px; + margin: 10px 0; + color: #333; +} + +p { + font-size: 16px; + color: #555; /* Slightly darker text color */ + margin: 10px 0; + text-align: left; +} + +a { + display: block; + text-align: center; + background-color: #007acc; + color: white; + padding: 10px; + text-decoration: none; + margin: 20px auto; + width: 150px; + border-radius: 5px; + transition: background-color 0.2s; +} + +a:hover { + background-color: #0058a9; +} diff --git a/Basic Blogging Platform/html/create.html b/Basic Blogging Platform/html/create.html new file mode 100644 index 0000000..9a2631e --- /dev/null +++ b/Basic Blogging Platform/html/create.html @@ -0,0 +1,17 @@ + + + + Create a Post + + + +

Create a New Blog Post

+
+ +
+ +
+ +
+ + diff --git a/Basic Blogging Platform/html/index.html b/Basic Blogging Platform/html/index.html new file mode 100644 index 0000000..125da78 --- /dev/null +++ b/Basic Blogging Platform/html/index.html @@ -0,0 +1,19 @@ + + + + My Blog + + + +

Welcome to My Blog

+ + Create a new post + +