Advertisement
AtEchoOff

Socially App Starter Code

Aug 30th, 2024 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. ==========================================================app.py==========================================================
  2.  
  3. from flask import Flask, render_template, request, session, make_response, redirect, jsonify
  4. app = Flask(__name__)
  5. @app.route('/')
  6. def index():
  7. return render_template("home.html")
  8.  
  9. if __name__ == '__main__':
  10. import os
  11. HOST = os.environ.get('SERVER_HOST', 'localhost')
  12. try:
  13. PORT = int(os.environ.get('SERVER_PORT', '5555'))
  14. except ValueError:
  15. PORT = 5555
  16. app.run(HOST, PORT, debug=True)
  17. ==========================================================home.html==========================================================
  18. <!DOCTYPE html>
  19. <html>
  20. <head>
  21. <title>Social APP</title>
  22.  
  23. <!-- Bootstrap CSS -->
  24. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  25.  
  26. <!-- add Font Awesome --->
  27. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  28.  
  29. <link rel="stylesheet" type="text/css" href="/static/style.css">
  30.  
  31. </head>
  32. <body>
  33. <header class="site-header">
  34. <nav class="navbar navbar-expand-md navbar-dark bg-steel fixed-top">
  35. <div class="container">
  36. <a class="navbar-brand mr-4" href="/">Socially</a>
  37.  
  38. <div class="navbar-nav mr-auto">
  39. <a class="nav-item nav-link" href="/">Home</a>
  40. </div>
  41. <!-- Navbar Right Side -->
  42. <div class="navbar-nav">
  43. <a href="#" class="notification">
  44. <span>Likes</span>
  45. <span class="badge"></span>
  46. </a>
  47. </div>
  48.  
  49. </div>
  50. </nav>
  51. </header>
  52. <main role="main" class="container">
  53. <div class="row">
  54. <div class="col-md-8">
  55. <h1>"Socially" Web App.</h1>
  56. <i id="likeBtn" class="fa fa-thumbs-up"></i>
  57. </div>
  58.  
  59. </div>
  60. </main>
  61.  
  62.  
  63. <!-- Optional JavaScript -->
  64. <!-- jQuery -->
  65. <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  66.  
  67. </body>
  68. <script src="static/index.js"></script>
  69. </html>
  70.  
  71. ==========================================================style.css====================================================================
  72. body {
  73. background: #f0f0f0;
  74. color: #333333;
  75. margin-top: 5rem;
  76. }
  77.  
  78. h1, h2, h3, h4, h5, h6 {
  79. color: #444444;
  80. }
  81. .navbar {
  82. background-color: #ae5a24;
  83. }
  84. .navbar-brand {
  85. font-weight: bolder;
  86. }
  87.  
  88. .site-header .navbar-nav .nav-link {
  89. color: white;
  90. }
  91.  
  92. .site-header .navbar-nav .nav-link:hover {
  93. color: #00e1ff;
  94. }
  95.  
  96. .site-header .navbar-nav .nav-link.active {
  97. font-weight: 500;
  98. }
  99.  
  100. .notification {
  101. background-color: #555;
  102. color: white;
  103. text-decoration: none;
  104. padding: 5px 5px;
  105. position: relative;
  106. display: inline-block;
  107. border-radius: 50px;
  108. }
  109.  
  110. .notification:hover {
  111. background: red;
  112. }
  113.  
  114. .notification .badge {
  115. position: absolute;
  116. top: -10px;
  117. right: -10px;
  118. padding: 5px 10px;
  119. border-radius: 50%;
  120. background-color: red;
  121. color: white;
  122. }
  123.  
  124. .fa {
  125. font-size: 100px;
  126. cursor: pointer;
  127. user-select: none;
  128. }
  129.  
  130. .fa:hover {
  131. color: darkblue;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement