├── .gitignore ├── celerybeat-schedule ├── instance └── database.sqlite3 ├── __pycache__ └── app.cpython-310.pyc ├── backend ├── __pycache__ │ ├── config.cpython-310.pyc │ ├── models.cpython-310.pyc │ ├── routes.cpython-310.pyc │ ├── resources.cpython-310.pyc │ └── create_initial_data.cpython-310.pyc ├── celery │ ├── __pycache__ │ │ ├── tasks.cpython-310.pyc │ │ └── celery_factory.cpython-310.pyc │ ├── user-downloads │ │ ├── blog.csv │ │ └── blog_data_b7881c24-9ef7-4b25-953b-71cd5f51a471.csv │ ├── mail_service.py │ ├── celery_factory.py │ ├── celery_schedule.py │ └── tasks.py ├── config.py ├── create_initial_data.py ├── models.py ├── resources.py └── routes.py ├── frontend ├── app.js ├── components │ ├── BlogCard.js │ ├── Navbar.js │ └── User.js ├── pages │ ├── DisplayBlogPage.js │ ├── BlogsListPage.js │ ├── RegisterPage.js │ ├── AdminDashboardPage.js │ ├── ExploreUsersPage.js │ └── LoginPage.js ├── utils │ ├── store.js │ ├── router.js │ └── fetchWithAuth.js └── index.html ├── req.txt ├── app.py └── seed.py /.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | backend/__pycache__ 3 | user-downloads 4 | **/__pycache__/ -------------------------------------------------------------------------------- /celerybeat-schedule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/celerybeat-schedule -------------------------------------------------------------------------------- /instance/database.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/instance/database.sqlite3 -------------------------------------------------------------------------------- /__pycache__/app.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/__pycache__/app.cpython-310.pyc -------------------------------------------------------------------------------- /backend/__pycache__/config.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/__pycache__/config.cpython-310.pyc -------------------------------------------------------------------------------- /backend/__pycache__/models.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/__pycache__/models.cpython-310.pyc -------------------------------------------------------------------------------- /backend/__pycache__/routes.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/__pycache__/routes.cpython-310.pyc -------------------------------------------------------------------------------- /backend/__pycache__/resources.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/__pycache__/resources.cpython-310.pyc -------------------------------------------------------------------------------- /backend/celery/__pycache__/tasks.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/celery/__pycache__/tasks.cpython-310.pyc -------------------------------------------------------------------------------- /backend/__pycache__/create_initial_data.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/__pycache__/create_initial_data.cpython-310.pyc -------------------------------------------------------------------------------- /backend/celery/__pycache__/celery_factory.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdityaBaxla/24_Sep_BlogLite/HEAD/backend/celery/__pycache__/celery_factory.cpython-310.pyc -------------------------------------------------------------------------------- /frontend/app.js: -------------------------------------------------------------------------------- 1 | import Navbar from "./components/Navbar.js" 2 | import router from "./utils/router.js" 3 | import store from "./utils/store.js" 4 | 5 | const app = new Vue({ 6 | el : '#app', 7 | template : ` 8 |
{{author_email}}
7 |Published : {{formattedDate}}
9 |Published : {{formattedDate}}
7 |followers {{followers}}
10 |Posts {{posts}}
11 | 12 | 13 |In today’s fast-paced world, productivity is essential. Here are 10 tips that can help you get more done in less time.
130 |Implement these tips, and you’ll notice a significant boost in your productivity.
136 | """, 137 | 138 | """ 139 |Meditation has numerous benefits for mental health. Here's how to start:
140 |Try meditating for just 10 minutes a day, and see how it changes your mind and body.
146 | """, 147 | 148 | """ 149 |Coding can be an enjoyable journey when you have the right resources. Below are some useful tips:
150 |By following these steps, you'll become a better programmer and enjoy the process more!
156 | """, 157 | 158 | """ 159 |Healthy eating is the foundation of a good life. Here are some tips to keep in mind:
160 |Remember, your body is your temple, and nourishing it properly is key to a happy life.
166 | """, 167 | 168 | """ 169 |Freelancing offers many benefits like flexible working hours, but it can also come with challenges. Here’s how to make it work for you:
170 |By maintaining discipline, you can have a successful freelance career with a balanced life.
176 | """, 177 | 178 | """ 179 |Traveling on a budget doesn’t mean missing out on great experiences. Here are some strategies to help:
180 |With these tips, you can travel the world without breaking the bank!
186 | """, 187 | 188 | """ 189 |Starting a blog can be overwhelming, but following these steps will help you get started:
190 |Once you have these basics in place, you’ll be well on your way to becoming a successful blogger.
196 | """, 197 | 198 | """ 199 |When managing stress, it’s important to practice self-care regularly. Here’s how:
200 |By focusing on self-care, you can reduce stress and improve your overall well-being.
206 | """, 207 | 208 | """ 209 |Investing in real estate can be a smart financial decision. Consider these factors before getting started:
210 |Real estate is a long-term investment, so be patient and plan for the future.
216 | """, 217 | 218 | """ 219 |Public speaking is a vital skill that can boost your career. Here are a few techniques to improve:
220 |With practice and confidence, you’ll become a powerful and engaging speaker.
226 | """ 227 | ] 228 | 229 | 230 | def get_random_name(): 231 | return NAMES_LIST[random.randint(0,95)] 232 | 233 | def get_random_title(): 234 | return BLOG_TITLES[random.randint(0,99)] 235 | 236 | def get_random_caption(): 237 | return BLOG_CONTENT[random.randint(0,9)] 238 | 239 | 240 | def register_user(email, password): 241 | response = requests.post(f"{BASE_URL}/register", json={"email": email, "password": password, "role" : "user"}) 242 | return response.json() 243 | 244 | def login_user(email, password): 245 | response = requests.post(f"{BASE_URL}/login", json={"email": email, "password": password }) 246 | return response.json() 247 | 248 | def create_blog(auth_token, title, caption, image_url='https://picsum.photos/200'): 249 | headers = { 250 | 'Authentication-Token': f'{auth_token}' # Assuming you're using Bearer token 251 | } 252 | response = requests.post(f"{BASE_URL}/api/blogs", json={ 253 | "title": title, 254 | "caption": caption, 255 | "image_url": image_url 256 | }, headers=headers) 257 | return response.json() 258 | 259 | def follow_user(auth_token, follower_id, followed_id): 260 | headers = { 261 | 'Authentication-Token': f'{auth_token}' # Assuming you're using Bearer token 262 | } 263 | response = requests.get(f"{BASE_URL}/follow/{followed_id}", headers=headers) 264 | return response.json() 265 | 266 | def seed_database(): 267 | users = [] 268 | # Register 10 users and log them in 269 | for i in range(10): 270 | email = f"{get_random_name()}@example.com" 271 | password = "1234" 272 | register_user(email, password) 273 | login_response = login_user(email, password) 274 | if 'token' in login_response: 275 | users.append({"id": i + 1, "email": email, "token": login_response['token']}) 276 | 277 | 278 | # Create blogs for each user 279 | for user in users: 280 | user_id = user['id'] 281 | auth_token = user['token'] 282 | for i in range(3): # Create 3 blogs per user 283 | title = get_random_title() 284 | caption = get_random_caption() 285 | create_blog(auth_token, title, caption) 286 | 287 | # Create followers 288 | for user in users: 289 | followed_users = random.sample([u for u in users if u['id'] != user['id']], k=random.randint(1, len(users) - 1)) 290 | for followed in followed_users: 291 | follow_user(user['token'], user['id'], followed['id']) 292 | 293 | if __name__ == "__main__": 294 | seed_database() 295 | --------------------------------------------------------------------------------