Got new flaskr tutorial finished with blog and dashboard
authorPerfectfire33 <perfectfireiii@gmail.com>
Wed, 29 Jun 2022 22:19:03 +0000 (18:19 -0400)
committerPerfectfire33 <perfectfireiii@gmail.com>
Wed, 29 Jun 2022 22:19:03 +0000 (18:19 -0400)
33 files changed:
.idea/workspace.xml
Readme.txt
__pycache__/flaskr.cpython-37.pyc
flaskr.db
flaskr.py
flaskr/Readme2 [new file with mode: 0644]
flaskr/__init__.py [new file with mode: 0644]
flaskr/__pycache__/__init__.cpython-37.pyc [new file with mode: 0644]
flaskr/__pycache__/auth.cpython-37.pyc [new file with mode: 0644]
flaskr/__pycache__/blog.cpython-37.pyc [new file with mode: 0644]
flaskr/__pycache__/dashboard.cpython-37.pyc [new file with mode: 0644]
flaskr/__pycache__/db.cpython-37.pyc [new file with mode: 0644]
flaskr/auth.py [new file with mode: 0644]
flaskr/blog.py [new file with mode: 0644]
flaskr/dashboard.py [new file with mode: 0644]
flaskr/db.py [new file with mode: 0644]
flaskr/db2.py [new file with mode: 0644]
flaskr/schema.sql [new file with mode: 0644]
flaskr/static/style.css [new file with mode: 0644]
flaskr/templates/auth/login.html [new file with mode: 0644]
flaskr/templates/auth/register.html [new file with mode: 0644]
flaskr/templates/base.html [new file with mode: 0644]
flaskr/templates/blog/create.html [new file with mode: 0644]
flaskr/templates/blog/index.html [new file with mode: 0644]
flaskr/templates/blog/update.html [new file with mode: 0644]
flaskr/templates/dashboard.html [new file with mode: 0644]
instance/flaskr.sqlite [new file with mode: 0644]
schema.sql [deleted file]
static/style.css [deleted file]
static/style2.css [new file with mode: 0644]
templates/base.html [new file with mode: 0644]
templates/dashboard.html
templates/register.html [new file with mode: 0644]

index b42d182850b6480ca94a5bb7f803b29bad660de3..b8c02691c91a6bb92f3873f1f73a6864b49600b2 100644 (file)
@@ -2,7 +2,31 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="e00b4877-6392-4152-a4a7-f9ffd3e1faca" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/flaskr/Readme2" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/__init__.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/auth.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/blog.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/dashboard.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/db.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/db2.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/static/style.css" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/auth/login.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/auth/register.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/base.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/blog/create.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/blog/index.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/blog/update.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/flaskr/templates/dashboard.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/static/style2.css" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/templates/register.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Readme.txt" beforeDir="false" afterPath="$PROJECT_DIR$/Readme.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/flaskr.db" beforeDir="false" afterPath="$PROJECT_DIR$/flaskr.db" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/flaskr.py" beforeDir="false" afterPath="$PROJECT_DIR$/flaskr.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/schema.sql" beforeDir="false" afterPath="$PROJECT_DIR$/flaskr/schema.sql" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/static/style.css" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/templates/dashboard.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/dashboard.html" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="true">
+      <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/flaskr.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="520">
-              <caret line="122" lean-forward="true" selection-start-line="122" selection-end-line="122" />
+            <state relative-caret-position="480">
+              <caret line="87" selection-start-line="87" selection-end-line="88" selection-end-column="15" />
               <folding>
                 <element signature="e#18#33#0" expanded="true" />
               </folding>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/flaskr - Copy.py">
+        <entry file="file://$PROJECT_DIR$/flaskr/auth.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-460">
-              <caret line="55" column="10" selection-start-line="55" selection-start-column="10" selection-end-line="55" selection-end-column="10" />
+            <state relative-caret-position="1440">
+              <caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
+              <folding>
+                <element signature="e#0#99#0" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/sql/upload_file.sql">
+        <entry file="file://$PROJECT_DIR$/flaskr/blog.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="40">
-              <caret line="2" column="19" lean-forward="true" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
+            <state relative-caret-position="240">
+              <caret line="12" column="12" lean-forward="true" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
+              <folding>
+                <element signature="e#0#90#0" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/templates/mediaserver_file_list.html">
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/flaskr/dashboard.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="200">
-              <caret line="10" column="27" lean-forward="true" selection-start-line="10" selection-start-column="27" selection-end-line="10" selection-end-column="27" />
+            <state relative-caret-position="180">
+              <caret line="9" column="12" lean-forward="true" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/Readme.txt">
+        <entry file="file://$PROJECT_DIR$/flaskr/__init__.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="160">
-              <caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
+            <state relative-caret-position="860">
+              <caret line="45" column="43" selection-start-line="45" selection-start-column="43" selection-end-line="45" selection-end-column="43" />
+              <folding>
+                <element signature="e#0#9#0" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/schema.sql">
+        <entry file="file://$PROJECT_DIR$/flaskr/templates/dashboard.html">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="400">
-              <caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
+            <state relative-caret-position="160">
+              <caret line="8" column="21" lean-forward="true" selection-start-line="8" selection-start-column="21" selection-end-line="8" selection-end-column="21" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/templates/mediaserver_addFile.html">
+        <entry file="file://$PROJECT_DIR$/flaskr/static/style.css">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="260">
-              <caret line="13" column="9" selection-start-line="13" selection-start-column="9" selection-end-line="13" selection-end-column="9" />
+            <state relative-caret-position="40">
+              <caret line="2" column="58" lean-forward="true" selection-start-line="2" selection-start-column="58" selection-end-line="2" selection-end-column="58" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/templates/dashboard.html">
+        <entry file="file://$PROJECT_DIR$/flaskr/templates/base.html">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-7">
-              <caret line="15" column="21" selection-start-line="15" selection-start-column="21" selection-end-line="15" selection-end-column="21" />
+            <state relative-caret-position="100">
+              <caret line="5" column="6" lean-forward="true" selection-start-line="5" selection-start-column="6" selection-end-line="5" selection-end-column="6" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/templates/add_item.html">
+        <entry file="file://$PROJECT_DIR$/flaskr/templates/blog/index.html">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-7">
-              <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
+            <state relative-caret-position="120">
+              <caret line="6" column="13" lean-forward="true" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
             </state>
           </provider>
         </entry>
       <find>delete</find>
       <find>download_</find>
       <find>default_path</find>
+      <find>created</find>
     </findStrings>
   </component>
   <component name="Git.Settings">
         <option value="$PROJECT_DIR$/templates/mediaserver_settings.html" />
         <option value="$PROJECT_DIR$/Readme.txt" />
         <option value="$PROJECT_DIR$/templates/layout.html" />
-        <option value="$PROJECT_DIR$/templates/dashboard.html" />
         <option value="$PROJECT_DIR$/sql/upload_file.sql" />
         <option value="$PROJECT_DIR$/schema.sql" />
         <option value="$PROJECT_DIR$/templates/mediaserver_file_list.html" />
+        <option value="$PROJECT_DIR$/templates/base.html" />
+        <option value="$PROJECT_DIR$/templates/register.html" />
+        <option value="$PROJECT_DIR$/static/style.css" />
+        <option value="$PROJECT_DIR$/db.py" />
+        <option value="$PROJECT_DIR$/auth.py" />
+        <option value="$PROJECT_DIR$/templates/dashboard.html" />
+        <option value="$PROJECT_DIR$/__init__.py" />
+        <option value="$PROJECT_DIR$/flaskr/db.py" />
+        <option value="$PROJECT_DIR$/flaskr/Readme2" />
+        <option value="$PROJECT_DIR$/flaskr/templates/auth/register.html" />
+        <option value="$PROJECT_DIR$/flaskr/templates/auth/login.html" />
+        <option value="$PROJECT_DIR$/flaskr/schema.sql" />
+        <option value="$PROJECT_DIR$/flaskr/auth.py" />
+        <option value="$PROJECT_DIR$/flaskr/templates/blog/create.html" />
+        <option value="$PROJECT_DIR$/flaskr/templates/blog/update.html" />
+        <option value="$PROJECT_DIR$/flaskr/db2.py" />
         <option value="$PROJECT_DIR$/flaskr.py" />
+        <option value="$PROJECT_DIR$/flaskr/templates/blog/index.html" />
+        <option value="$PROJECT_DIR$/flaskr/templates/base.html" />
+        <option value="$PROJECT_DIR$/flaskr/dashboard.py" />
+        <option value="$PROJECT_DIR$/flaskr/blog.py" />
+        <option value="$PROJECT_DIR$/flaskr/templates/dashboard.html" />
+        <option value="$PROJECT_DIR$/flaskr/__init__.py" />
       </list>
     </option>
   </component>
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
             <path>
-              <item name="flaskr_mediaserver" type="b2602c69:ProjectViewProjectNode" />
-              <item name="flaskr_mediaserver" type="462c0819:PsiDirectoryNode" />
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="flaskr" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="flaskr" type="462c0819:PsiDirectoryNode" />
+              <item name="static" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
-              <item name="flaskr_mediaserver" type="b2602c69:ProjectViewProjectNode" />
-              <item name="flaskr_mediaserver" type="462c0819:PsiDirectoryNode" />
-              <item name="sql" type="462c0819:PsiDirectoryNode" />
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="flaskr" type="462c0819:PsiDirectoryNode" />
+              <item name="templates" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="flaskr" type="462c0819:PsiDirectoryNode" />
+              <item name="templates" type="462c0819:PsiDirectoryNode" />
+              <item name="auth" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
-              <item name="flaskr_mediaserver" type="b2602c69:ProjectViewProjectNode" />
-              <item name="flaskr_mediaserver" type="462c0819:PsiDirectoryNode" />
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="flaskr" type="462c0819:PsiDirectoryNode" />
               <item name="templates" type="462c0819:PsiDirectoryNode" />
+              <item name="blog" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
+              <item name="static" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
-              <item name="flaskr_mediaserver" type="b2602c69:ProjectViewProjectNode" />
-              <item name="flaskr_mediaserver" type="462c0819:PsiDirectoryNode" />
+              <item name="openhouseparty.online" type="b2602c69:ProjectViewProjectNode" />
+              <item name="openhouseparty.online" type="462c0819:PsiDirectoryNode" />
               <item name="templates" type="462c0819:PsiDirectoryNode" />
-              <item name="pcparts" type="462c0819:PsiDirectoryNode" />
             </path>
           </expand>
           <select />
         </subPane>
       </pane>
+      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
     <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
   </component>
   <component name="RecentsManager">
-    <key name="MoveFile.RECENT_KEYS">
-      <recent name="C:\Users\Joseph\Documents\GitHub\flaskr_mediaserver\templates" />
-    </key>
     <key name="CopyFile.RECENT_KEYS">
       <recent name="C:\Users\Joseph\Documents\GitHub\flaskr_mediaserver\templates" />
       <recent name="C:\Users\Joseph\Documents\GitHub\flaskr_mediaserver\templates\pcparts" />
     </key>
+    <key name="MoveFile.RECENT_KEYS">
+      <recent name="C:\Users\Joseph\Documents\GitHub\openhouseparty.online\flaskr\static" />
+      <recent name="C:\Users\Joseph\Documents\GitHub\openhouseparty.online\flaskr" />
+      <recent name="C:\Users\Joseph\Documents\GitHub\flaskr_mediaserver\templates" />
+    </key>
   </component>
   <component name="RunDashboard">
     <option name="ruleStates">
     </layout>
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/flaskr.db">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="64">
-          <caret line="21" column="11" lean-forward="true" selection-start-line="21" selection-start-column="11" selection-end-line="21" selection-end-column="11" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/sql/select_all_items.sql">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/layout.html">
+    <entry file="file://$PROJECT_DIR$/templates/pcparts_addBuild.html">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="-7">
-          <caret line="16" column="11" selection-start-line="16" selection-start-column="11" selection-end-line="16" selection-end-column="11" />
+          <caret line="25" column="19" selection-start-line="25" selection-start-column="19" selection-end-line="25" selection-end-column="19" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/login.html">
+    <entry file="file://$PROJECT_DIR$/templates/item_list.html">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr - Copy.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-7" />
+        <state relative-caret-position="1040">
+          <caret line="55" column="10" selection-start-line="55" selection-start-column="10" selection-end-line="55" selection-end-column="10" />
+        </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/dashboard.html">
+    <entry file="file://$PROJECT_DIR$/sql/upload_file.sql">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-7">
-          <caret line="15" column="21" selection-start-line="15" selection-start-column="21" selection-end-line="15" selection-end-column="21" />
+        <state relative-caret-position="40">
+          <caret line="2" column="19" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/add_item.html">
+    <entry file="file://$PROJECT_DIR$/templates/mediaserver_file_list.html">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-7">
-          <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
+        <state relative-caret-position="200">
+          <caret line="10" column="27" selection-start-line="10" selection-start-column="27" selection-end-line="10" selection-end-column="27" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/pcparts_addBuild.html">
+    <entry file="file://$PROJECT_DIR$/templates/mediaserver_addFile.html">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-7">
-          <caret line="25" column="19" selection-start-line="25" selection-start-column="19" selection-end-line="25" selection-end-column="19" />
+        <state relative-caret-position="260">
+          <caret line="13" column="9" selection-start-line="13" selection-start-column="9" selection-end-line="13" selection-end-column="9" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/schema.sql">
+    <entry file="file://$PROJECT_DIR$/templates/add_item.html">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="400">
-          <caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
+        <state relative-caret-position="600">
+          <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/flaskr - Copy.py">
+    <entry file="file://$PROJECT_DIR$/templates/layout.html">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-460">
-          <caret line="55" column="10" selection-start-line="55" selection-start-column="10" selection-end-line="55" selection-end-column="10" />
+        <state relative-caret-position="120">
+          <caret line="6" column="19" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/item_list.html">
+    <entry file="file://$PROJECT_DIR$/templates/login.html">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/sql/upload_file.sql">
+    <entry file="file://$PROJECT_DIR$/static/style2.css">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr.db">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="40">
-          <caret line="2" column="19" lean-forward="true" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
+        <state relative-caret-position="420">
+          <caret line="21" column="11" lean-forward="true" selection-start-line="21" selection-start-column="11" selection-end-line="21" selection-end-column="11" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/templates/base.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="60">
+          <caret line="3" column="5" selection-start-line="3" selection-start-column="5" selection-end-line="3" selection-end-column="5" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/templates/register.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="80">
+          <caret line="4" column="14" selection-start-line="4" selection-start-column="14" selection-end-line="4" selection-end-column="14" />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/Readme.txt">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="160">
-          <caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
+        <state relative-caret-position="120">
+          <caret line="6" column="4" lean-forward="true" selection-start-line="6" selection-start-column="4" selection-end-line="6" selection-end-column="4" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/mediaserver_addFile.html">
+    <entry file="file://$PROJECT_DIR$/flaskr/Readme2">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="260">
-          <caret line="13" column="9" selection-start-line="13" selection-start-column="9" selection-end-line="13" selection-end-column="9" />
+        <state relative-caret-position="240">
+          <caret line="12" column="7" lean-forward="true" selection-start-line="12" selection-start-column="7" selection-end-line="12" selection-end-column="7" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/templates/mediaserver_file_list.html">
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/auth/login.html">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="200">
-          <caret line="10" column="27" lean-forward="true" selection-start-line="10" selection-start-column="27" selection-end-line="10" selection-end-column="27" />
+          <caret line="10" column="25" lean-forward="true" selection-start-line="10" selection-start-column="25" selection-end-line="10" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/db.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="240">
+          <caret line="12" column="9" lean-forward="true" selection-start-line="12" selection-start-column="9" selection-end-line="12" selection-end-column="9" />
+          <folding>
+            <element signature="e#0#14#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/schema.sql">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="260">
+          <caret line="13" column="27" lean-forward="true" selection-start-line="13" selection-start-column="27" selection-end-line="13" selection-end-column="27" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/auth/register.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="6" column="19" lean-forward="true" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/blog/update.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="6" column="19" lean-forward="true" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/blog/create.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="100">
+          <caret line="5" lean-forward="true" selection-start-line="5" selection-end-line="5" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/templates/dashboard.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="20">
+          <caret line="1" column="16" lean-forward="true" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/db2.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="6" selection-start-line="6" selection-end-line="6" />
+          <folding>
+            <element signature="e#0#14#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/blog/index.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="6" column="13" lean-forward="true" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/base.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="100">
+          <caret line="5" column="6" lean-forward="true" selection-start-line="5" selection-start-column="6" selection-end-line="5" selection-end-column="6" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/static/style.css">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="40">
+          <caret line="2" column="58" lean-forward="true" selection-start-line="2" selection-start-column="58" selection-end-line="2" selection-end-column="58" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/blog.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="240">
+          <caret line="12" column="12" lean-forward="true" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
+          <folding>
+            <element signature="e#0#90#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/flaskr.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="520">
-          <caret line="122" lean-forward="true" selection-start-line="122" selection-end-line="122" />
+        <state relative-caret-position="480">
+          <caret line="87" selection-start-line="87" selection-end-line="88" selection-end-column="15" />
           <folding>
             <element signature="e#18#33#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/auth.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1440">
+          <caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
+          <folding>
+            <element signature="e#0#99#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="860">
+          <caret line="45" column="43" selection-start-line="45" selection-start-column="43" selection-end-line="45" selection-end-column="43" />
+          <folding>
+            <element signature="e#0#9#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/templates/dashboard.html">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="160">
+          <caret line="8" column="21" lean-forward="true" selection-start-line="8" selection-start-column="21" selection-end-line="8" selection-end-column="21" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/flaskr/dashboard.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="180">
+          <caret line="9" column="12" lean-forward="true" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>
\ No newline at end of file
index 5198c398674a70b0afc4233942e3ea2ba46db6b4..fba2ad3a0929646d59d69e6bbe63f83c4d02a207 100644 (file)
@@ -1,5 +1,5 @@
 run in command prompt before running app:
-SET FLASK_APP=C:\Users\Joseph\Documents\GitHub\flaskr_mediaserver\flaskr.py
+SET FLASK_APP=C:\Users\Joseph\Documents\GitHub\openhouseparty.online\flaskr.py
 
 then init the db:
 flask initdb
index 3e00aa47fb5ee1fb87690ba901abd07c2ccc8614..3f194519dd77a28e2256bfe409b15fe1caa6c3cd 100644 (file)
Binary files a/__pycache__/flaskr.cpython-37.pyc and b/__pycache__/flaskr.cpython-37.pyc differ
index 8224ffbea589bced26314ac037fe9119008fc6db..7b4498e98bc571192c4a6159d4b0d9b29c62cd99 100644 (file)
Binary files a/flaskr.db and b/flaskr.db differ
index de0f9338f0ee454325b74e15c4729c1ae63813ad..090cd6a3053d08032e93b8c47ff5a67187762c77 100644 (file)
--- a/flaskr.py
+++ b/flaskr.py
@@ -1,13 +1,10 @@
 # all the imports
 import os, time
 from datetime import date
-import sqlite3
-import sys
-from flask import Flask, request, session, g, redirect, url_for, abort, \
+from flask import Flask, request, session, redirect, url_for, abort, \
      render_template, flash, send_from_directory
 from werkzeug.utils import secure_filename
-from flask_script import Manager, Server
-
+from flaskr.db import get_db
 
 """ ---------------- ---------------- App Init ---------------- ---------------- """
 UPLOAD_FOLDER = 'c:/Users/Joseph/Downloads/Media_Server_Upload'
@@ -40,46 +37,14 @@ def allowed_file(filename):
 
 
 
-""" ---------------- ---------------- Database Functions ---------------- ---------------- """
-def connect_db():
-    #Connects to the specific database
-    rv = sqlite3.connect(app.config['DATABASE'])
-    rv.row_factory = sqlite3.Row
-    return rv
-
-def get_db():
-    #Opens a new database connection if there is none yet for the current application context
-    if not hasattr(g, 'sqlite_db'):
-        g.sqlite_db = connect_db()
-    return g.sqlite_db
-
-@app.teardown_appcontext
-def close_db(error):
-    #Closes the database again at the end of the request
-    if hasattr(g, 'sqlite_db'):
-        g.sqlite_db.close()
-
-
-def init_db():
-    db = get_db()
-    with app.open_resource('schema.sql', mode='r') as f:
-        db.cursor().executescript(f.read())
-    #db.execute('PRAGMA FOREIGN_KEYS=ON')
-    #db.execute('PRAGMA foreign_keys  = "1"')
-    db.commit()
 
-@app.cli.command('initdb')
-def initdb_command():
-    #Initializes the database
-    init_db()
-    print('Initialized the database.')
 
 
 
 
 
 """ ---------------- ---------------- General Functions ---------------- ---------------- """
-#Login
+# Login
 @app.route('/login', methods=['GET', 'POST'])
 def login():
     error = None
@@ -91,19 +56,24 @@ def login():
         else:
             session['logged_in'] = True
             flash('You were logged in')
-            
-            #return redirect(url_for('item_list'))
+
+            # return redirect(url_for('item_list'))
             return render_template('dashboard.html')
     return render_template('login.html', error=error)
 
-#Logout
+
+# Logout
 @app.route('/logout')
 def logout():
     session.pop('logged_in', None)
     flash('You were logged out')
-    #return redirect(url_for('item_list'))
+    # return redirect(url_for('item_list'))
     return render_template('dashboard.html')
 
+
+
+
+
     
 #Get row count of a table
 def get_next_row(currentTable):
diff --git a/flaskr/Readme2 b/flaskr/Readme2
new file mode 100644 (file)
index 0000000..ffff917
--- /dev/null
@@ -0,0 +1,13 @@
+run in command prompt before running app:
+SET FLASK_APP=C:\Users\Joseph\Documents\GitHub\openhouseparty.online\flaskr\__init__.py
+
+then init the db:
+flask init-db
+
+then start server:
+flask run -h 127.0.0.1 -p 5000
+
+username for testing is:
+admin
+password for 'admin' user is:
+testing
\ No newline at end of file
diff --git a/flaskr/__init__.py b/flaskr/__init__.py
new file mode 100644 (file)
index 0000000..8dd2363
--- /dev/null
@@ -0,0 +1,48 @@
+import os
+
+from flask import Flask
+
+
+
+
+def create_app(test_config=None):
+    # create and configure the app
+    app = Flask(__name__, instance_relative_config=True)
+    app.config.from_mapping(
+        SECRET_KEY='dev',
+        DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
+    )
+
+    if test_config is None:
+        # load the instance config, if it exists, when not testing
+        app.config.from_pyfile('config.py', silent=True)
+    else:
+        # load the test config if passed in
+        app.config.from_mapping(test_config)
+
+    # ensure the instance folder exists
+    try:
+        os.makedirs(app.instance_path)
+    except OSError:
+        pass
+
+    # a simple page that says hello
+    @app.route('/hello')
+    def hello():
+        return 'Hello, World!'
+
+    from . import db
+    db.init_app(app)
+
+    from . import auth
+    app.register_blueprint(auth.bp)
+
+    from . import blog
+    app.register_blueprint(blog.bp)
+
+
+    from . import dashboard
+    app.register_blueprint(dashboard.bp)
+    app.add_url_rule('/', endpoint='index')
+
+    return app
\ No newline at end of file
diff --git a/flaskr/__pycache__/__init__.cpython-37.pyc b/flaskr/__pycache__/__init__.cpython-37.pyc
new file mode 100644 (file)
index 0000000..9fca84e
Binary files /dev/null and b/flaskr/__pycache__/__init__.cpython-37.pyc differ
diff --git a/flaskr/__pycache__/auth.cpython-37.pyc b/flaskr/__pycache__/auth.cpython-37.pyc
new file mode 100644 (file)
index 0000000..084dce9
Binary files /dev/null and b/flaskr/__pycache__/auth.cpython-37.pyc differ
diff --git a/flaskr/__pycache__/blog.cpython-37.pyc b/flaskr/__pycache__/blog.cpython-37.pyc
new file mode 100644 (file)
index 0000000..836a39e
Binary files /dev/null and b/flaskr/__pycache__/blog.cpython-37.pyc differ
diff --git a/flaskr/__pycache__/dashboard.cpython-37.pyc b/flaskr/__pycache__/dashboard.cpython-37.pyc
new file mode 100644 (file)
index 0000000..644a872
Binary files /dev/null and b/flaskr/__pycache__/dashboard.cpython-37.pyc differ
diff --git a/flaskr/__pycache__/db.cpython-37.pyc b/flaskr/__pycache__/db.cpython-37.pyc
new file mode 100644 (file)
index 0000000..2039a4b
Binary files /dev/null and b/flaskr/__pycache__/db.cpython-37.pyc differ
diff --git a/flaskr/auth.py b/flaskr/auth.py
new file mode 100644 (file)
index 0000000..a0818bd
--- /dev/null
@@ -0,0 +1,99 @@
+from flask import (
+    Blueprint, flash, redirect, render_template, request, url_for, session, g
+)
+from werkzeug.security import generate_password_hash, check_password_hash
+
+from flaskr.db import get_db
+import functools
+
+
+bp = Blueprint('auth', __name__, url_prefix='/auth')
+
+
+
+
+
+@bp.route('/register', methods=('GET', 'POST'))
+def register():
+    if request.method == 'POST':
+        username = request.form['username']
+        password = request.form['password']
+        db = get_db()
+        error = None
+
+        if not username:
+            error = 'Username is required.'
+        elif not password:
+            error = 'Password is required.'
+
+        if error is None:
+            try:
+                db.execute(
+                    "INSERT INTO user (user_name, user_password) VALUES (?, ?)",
+                    (username, generate_password_hash(password)),
+                )
+                db.commit()
+            except db.IntegrityError:
+                error = f"User {username} is already registered."
+            else:
+                return redirect(url_for("auth.login"))
+
+        flash(error)
+
+    return render_template('auth/register.html')
+
+
+
+@bp.route('/login', methods=('GET', 'POST'))
+def login():
+    if request.method == 'POST':
+        username = request.form['username']
+        password = request.form['password']
+        db = get_db()
+        error = None
+        user = db.execute(
+            'SELECT * FROM user WHERE user_name = ?', (username,)
+        ).fetchone()
+
+        if user is None:
+            error = 'Incorrect username.'
+        elif not check_password_hash(user['user_password'], password):
+            error = 'Incorrect password.'
+
+        if error is None:
+            session.clear()
+            session['user_id'] = user['user_id']
+            return redirect(url_for('index'))
+
+        flash(error)
+
+    return render_template('auth/login.html')
+
+
+
+@bp.before_app_request
+def load_logged_in_user():
+    user_id = session.get('user_id')
+
+    if user_id is None:
+        g.user = None
+    else:
+        g.user = get_db().execute(
+            'SELECT * FROM user WHERE user_id = ?', (user_id,)
+        ).fetchone()
+
+
+@bp.route('/logout')
+def logout():
+    session.clear()
+    return redirect(url_for('index'))
+
+def login_required(view):
+    @functools.wraps(view)
+    def wrapped_view(**kwargs):
+        if g.user is None:
+            return redirect(url_for('auth.login'))
+
+        return view(**kwargs)
+
+    return wrapped_view
\ No newline at end of file
diff --git a/flaskr/blog.py b/flaskr/blog.py
new file mode 100644 (file)
index 0000000..4c25a3e
--- /dev/null
@@ -0,0 +1,101 @@
+from flask import (
+    Blueprint, flash, g, redirect, render_template, request, url_for
+)
+from werkzeug.exceptions import abort
+
+from flaskr.auth import login_required
+from flaskr.db import get_db
+
+bp = Blueprint('blog', __name__)
+
+
+@bp.route('/blog')
+def index():
+    db = get_db()
+    posts = db.execute(
+        'SELECT p.post_id, post_title, post_body, post_created, post_author_id, user_name'
+        ' FROM post p JOIN user u ON p.post_author_id = u.user_id'
+        ' ORDER BY post_created DESC'
+    ).fetchall()
+    return render_template('blog/index.html', posts=posts)
+
+
+@bp.route('/create', methods=('GET', 'POST'))
+@login_required
+def create():
+    if request.method == 'POST':
+        title = request.form['title']
+        body = request.form['body']
+        error = None
+
+        if not title:
+            error = 'Title is required.'
+
+        if error is not None:
+            flash(error)
+        else:
+            db = get_db()
+            db.execute(
+                'INSERT INTO post (post_title, post_body, post_author_id)'
+                ' VALUES (?, ?, ?)',
+                (title, body, g.user['user_id'])
+            )
+            db.commit()
+            return redirect(url_for('blog.index'))
+
+    return render_template('blog/create.html')
+
+
+def get_post(id, check_author=True):
+    post = get_db().execute(
+        'SELECT p.post_id, post_title, post_body, post_created, post_author_id, user_name'
+        ' FROM post p JOIN user u ON p.post_author_id = u.user_id'
+        ' WHERE p.post_id = ?',
+        (id,)
+    ).fetchone()
+
+    if post is None:
+        abort(404, f"Post id {id} doesn't exist.")
+
+    if check_author and post['post_author_id'] != g.user['user_id']:
+        abort(403)
+
+    return post
+
+
+@bp.route('/<int:id>/update', methods=('GET', 'POST'))
+@login_required
+def update(id):
+    post = get_post(id)
+
+    if request.method == 'POST':
+        title = request.form['title']
+        body = request.form['body']
+        error = None
+
+        if not title:
+            error = 'Title is required.'
+
+        if error is not None:
+            flash(error)
+        else:
+            db = get_db()
+            db.execute(
+                'UPDATE post SET post_title = ?, post_body = ?'
+                ' WHERE post_id = ?',
+                (title, body, id)
+            )
+            db.commit()
+            return redirect(url_for('blog.index'))
+
+    return render_template('blog/update.html', post=post)
+
+
+@bp.route('/<int:id>/delete', methods=('POST',))
+@login_required
+def delete(id):
+    get_post(id)
+    db = get_db()
+    db.execute('DELETE FROM post WHERE post_id = ?', (id,))
+    db.commit()
+    return redirect(url_for('blog.index'))
\ No newline at end of file
diff --git a/flaskr/dashboard.py b/flaskr/dashboard.py
new file mode 100644 (file)
index 0000000..faf177c
--- /dev/null
@@ -0,0 +1,11 @@
+
+from flask import (
+    Blueprint, flash, g, redirect, render_template, request, url_for
+)
+
+bp = Blueprint('dashboard', __name__)
+
+#Display Data - Dashboard
+@bp.route('/')
+def index():
+    return render_template('dashboard.html')
\ No newline at end of file
diff --git a/flaskr/db.py b/flaskr/db.py
new file mode 100644 (file)
index 0000000..4b61480
--- /dev/null
@@ -0,0 +1,43 @@
+import sqlite3
+
+import click
+from flask import current_app, g
+from flask.cli import with_appcontext
+
+""" ---------------- ---------------- Database Functions ---------------- ---------------- """
+def get_db():
+    if 'db' not in g:
+        g.db = sqlite3.connect(
+            current_app.config['DATABASE'],
+            detect_types=sqlite3.PARSE_DECLTYPES
+        )
+        g.db.row_factory = sqlite3.Row
+
+    return g.db
+
+
+def close_db(e=None):
+    db = g.pop('db', None)
+
+    if db is not None:
+        db.close()
+
+
+def init_db():
+    db = get_db()
+
+    with current_app.open_resource('schema.sql') as f:
+        db.executescript(f.read().decode('utf8'))
+
+
+@click.command('init-db')
+@with_appcontext
+def init_db_command():
+    """Clear the existing data and create new tables."""
+    init_db()
+    click.echo('Initialized the database.')
+
+
+def init_app(app):
+    app.teardown_appcontext(close_db)
+    app.cli.add_command(init_db_command)
\ No newline at end of file
diff --git a/flaskr/db2.py b/flaskr/db2.py
new file mode 100644 (file)
index 0000000..ddcb678
--- /dev/null
@@ -0,0 +1,6 @@
+import sqlite3
+
+import click
+from flask import current_app, g
+from flask.cli import with_appcontext
+
diff --git a/flaskr/schema.sql b/flaskr/schema.sql
new file mode 100644 (file)
index 0000000..ee656bf
--- /dev/null
@@ -0,0 +1,394 @@
+--Users table
+drop table if exists user;
+create table user (
+  user_id integer primary key autoincrement,
+  user_name text unique not null,
+  user_password text not null
+);
+
+drop table if exists post;
+CREATE TABLE post (
+  post_id INTEGER PRIMARY KEY AUTOINCREMENT,
+  post_author_id INTEGER NOT NULL,
+  post_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  post_title TEXT NOT NULL,
+  post_body TEXT NOT NULL,
+  FOREIGN KEY (post_author_id) REFERENCES user (user_id)
+);
+
+
+--Basic info about an item
+drop table if exists item;
+create table item (
+  item_id integer primary key autoincrement,
+  item_name text,
+  item_subtitle text,
+  item_desc text,
+  item_category text,
+  item_condition text,
+  item_conditionDesc text,
+  item_cost numeric,
+  item_returnPolicyDesc text,
+  item_insertDate datetime
+);
+
+
+--File Upload/Download Data
+drop table if exists file;
+create table file (
+  file_id integer primary key autoincrement,
+  file_name text,
+  file_path text,
+  file_size numeric,
+  file_today_date text
+);
+--Settings Data
+drop table if exists settings;
+create table settings (
+  settings_id integer primary key autoincrement,
+  settings_uploadFilePath text
+);
+
+INSERT INTO settings (settings_uploadFilePath) VALUES ('c:/Users/Joseph/Downloads/Media_Server_Upload');
+
+
+
+--Item Condition for a particular item
+drop table if exists itemCondition;
+create table itemCondition (
+  itemCondition_id integer primary key autoincrement,
+  itemCondition_name text
+);
+--Shipping info for a particular item
+drop table if exists itemShipping;
+create table itemShipping (
+  itemShipping_id integer primary key autoincrement,
+  itemShipping_method text,
+  itemShipping_weight numeric,
+  itemShipping_boxType text,
+  itemShipping_boxWidth numeric,
+  itemShipping_boxHeight numeric,
+  itemShipping_boxLength numeric,
+  itemShipping_handlingDuration datetime,
+  itemShipping_itemLocation text,
+  itemShipping_item_id integer,
+  FOREIGN KEY(itemShipping_item_id) REFERENCES item(item_id)
+);
+--Pictures for a particular item
+drop table if exists itemPicture;
+create table itemPicture (
+  itemPicture_id integer primary key autoincrement,
+  itemPicture_data blob,
+  itemPicture_caption text,
+  itemPicture_item_id integer,
+  FOREIGN KEY(itemPicture_item_id) REFERENCES item(item_id)
+);
+--Metrics for a particular item (will need to allow for adding new specs on the fly)
+drop table if exists itemSpecs;
+create table itemSpecs (
+  itemSpecs_id integer primary key autoincrement,
+  itemSpecs_name text,
+  itemSpecs_value text,
+  itemSpecs_item_id integer,
+  FOREIGN KEY(itemSpecs_item_id) REFERENCES item(item_id)
+);
+--Ebay-specific Item Data
+drop table if exists itemEbay;
+create table itemEbay (
+  itemEbay_id integer primary key autoincrement,
+  itemEbay_bid text,
+  itemEbay_buyItNow numeric,
+  itemEbay_reservePrice numeric,
+  itemEbay_fpQuantity integer,
+  itemEbay_fpBestOffer numeric,
+  itemEbay_fpMin numeric,
+  itemEbay_fpMax numeric,
+  itemEbay_duration datetime,
+  itemEbay_insertionFee numeric,
+  itemEbay_tax numeric,
+  itemEbay_item_id integer,
+  FOREIGN KEY(itemEbay_item_id) REFERENCES item(item_id)
+);
+--Table of PC Builds
+drop table if exists pcBuild;
+create table pcBuild (
+  pcBuild_id integer primary key autoincrement,
+  pcBuild_name text,
+  pcBuild_type text,
+  pcBuild_notes text,
+  pcBuild_avgPartAge numeric,
+  pcBuild_mobo_id integer,
+  pcBuild_case_id integer,
+  pcBuild_ram_id integer,
+  pcBuild_gpu_id integer,
+  pcBuild_ssd_id integer,
+  pcBuild_hdd_id integer,
+  pcBuild_cpu_id integer,
+  pcBuild_psu_id integer,
+  pcBuild_cpuCool_id integer,
+  pcBuild_fan_id integer,
+  pcBuild_ledkit_id integer,
+  pcBuild_os_id integer,
+  pcBuild_colorScheme text
+);
+--General PC Part Info
+drop table if exists pcPart;
+create table pcPart (
+  pcPart_id integer primary key autoincrement,
+  pcPart_type text,
+  pcPart_name text,
+  pcPart_modelNumber text,
+  pcPart_price numeric,
+  pcPart_desc text,
+  pcPart_brand text,
+  pcPart_condition text,
+  pcPart_notes text,
+  pcPart_age integer,
+  pcPart_pcBuild_id integer
+);
+--RAM Part-Specific Info
+drop table if exists ram;
+create table ram (
+  ram_id integer primary key autoincrement,
+  ram_kitSize text,
+  ram_stickSize integer,
+  ram_speed integer,
+  ram_type text,
+  ram_casLatency text,
+  ram_pcPart_id integer,
+  FOREIGN KEY(ram_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Solid State Drive Part-Specific Info
+drop table if exists ssd;
+create table ssd (
+  ssd_id integer primary key autoincrement,
+  ssd_formFactor text,
+  ssd_size integer,
+  ssd_interface text,
+  ssd_pcPart_id integer,
+  FOREIGN KEY(ssd_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+
+--HDD Part-Specific Info
+drop table if exists hdd;
+create table hdd (
+  hdd_id integer primary key autoincrement,
+  hdd_formFactor text,
+  hdd_size integer,
+  hdd_interface text,
+  hdd_cache integer,
+  hdd_rpm integer,
+  hdd_pcPart_id integer,
+  FOREIGN KEY(hdd_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Case Part-Specific Info
+drop table if exists cases;
+create table cases (
+  case_id integer primary key autoincrement,
+  case_formFactor text,
+  case_width numeric,
+  case_height numeric,
+  case_length numeric,
+  case_525bay integer,
+  case_350bay integer,
+  case_250bay integer,
+  case_80fan integer,
+  case_120fan integer,
+  case_140fan integer,
+  case_240fan integer,
+  case_otherFan text,
+  case_fpSpk integer,
+  case_fpMic integer,
+  case_fpUSB3 integer,
+  case_fpUSB2 integer,
+  case_psuSlots integer,
+  case_waterSlots text,
+  case_pcPart_id integer,
+  FOREIGN KEY(case_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Video Card Part-Specific Info
+drop table if exists gpu;
+create table gpu (
+  gpu_id integer primary key autoincrement,
+  gpu_vramType text,
+  gpu_vramSize text,
+  gpu_slotWidth text,
+  gpu_interface text,
+  gpu_6pin integer,
+  gpu_8pin integer,
+  gpu_clockSpeed numeric,
+  gpu_memClockSpeed numeric,
+  gpu_busBandwidth numeric,
+  gpu_crossfire integer,
+  gpu_sli integer,
+  gpu_pcPart_id integer,
+  FOREIGN KEY(gpu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Power Supply Part-Specific Info
+drop table if exists psu;
+create table psu (
+  psu_id integer primary key autoincrement,
+  psu_watt integer,
+  psu_effiency text,
+  psu_8pin integer,
+  psu_6pin integer,
+  psu_4pin integer,
+  psu_molex integer,
+  psu_sata integer,
+  psu_floppy integer,
+  psu_pcPart_id integer,
+  FOREIGN KEY(psu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Operating System Part-Specific Info
+drop table if exists os;
+create table os (
+  os_id integer primary key autoincrement,
+  os_type text,
+  os_bit integer,
+  os_version text,
+  os_pcPart_id integer,
+  FOREIGN KEY(os_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--CPU Cooler Part-Specific Info
+drop table if exists cpuCool;
+create table cpuCool (
+  cpuCool_id integer primary key autoincrement,
+  cpuCool_type text,
+  cpuCool_socketList text,
+  cpuCool_fanCount integer,
+  cpuCool_fanSize text,
+  cpuCool_pcPart_id integer,
+  FOREIGN KEY(cpuCool_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Motherboard Part-Specific Info
+drop table if exists mobo;
+create table mobo (
+  mobo_id integer primary key autoincrement,
+  mobo_ramType text,
+  mobo_CPUsocket text,
+  mobo_dimmSlots integer,
+  mobo_pciSlots integer,
+  mobo_pcie16Slots integer,
+  mobo_pcie8Slots integer,
+  mobo_pcie4Slots integer,
+  mobo_pcie1Slots integer,
+  mobo_chipset text,
+  mobo_cpu4pin integer,
+  mobo_cpu8pin integer,
+  mobo_cpu6pin integer,
+  mobo_pcPart_id integer,
+  FOREIGN KEY(mobo_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--Case Fans Part-Specific Info
+drop table if exists fan;
+create table fan (
+  fan_id integer primary key autoincrement,
+  fan_size integer,
+  fan_type text,
+  fan_color text,
+  fan_pcPart_id integer,
+  FOREIGN KEY(fan_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--LED Kits Part-Specific Info
+drop table if exists ledkit;
+create table ledkit (
+  ledkit_id integer primary key autoincrement,
+  ledkit_color text,
+  ledkit_type text,
+  ledkit_notes text,
+  ledkit_pcPart_id integer,
+  FOREIGN KEY(ledkit_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+--CPU Part-Specific Info
+drop table if exists cpu;
+create table cpu (
+  cpu_id integer primary key autoincrement,
+  cpu_socket text,
+  cpu_cores integer,
+  cpu_threads integer,
+  cpu_frequency numeric,
+  cpu_cache integer,
+  cpu_wattage integer,
+  cpu_pcPart_id integer,
+  FOREIGN KEY(cpu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
+);
+
+
+
+--Benchmark general data for a particular PC
+drop table if exists pcBenchmark;
+create table pcBenchmark (
+  pcBenchmark_id integer primary key autoincrement,
+  pcBenchmark_notes text,
+  pcBenchmark_score text,
+  pcBenchmark_fps text,
+  pcBenchmark_pcBuild_id integer,
+  FOREIGN KEY(pcBenchmark_pcBuild_id) REFERENCES pcBuild(pcBuild_id)
+);
+
+--Picture storage for a particular PC's benchmarks
+drop table if exists pcBenchmarkPictures;
+create table pcBenchmarkPictures (
+  pcBenchmarkPictures_id integer primary key autoincrement,
+  pcBenchmarkPictures_data blob,
+  pcBenchmarkPictures_pcBenchmark_id integer,
+  FOREIGN KEY(pcBenchmarkPictures_pcBenchmark_id) REFERENCES pcBenchmark(pcBenchmark_id)
+);
+
+--List of applications / games available for selection
+drop table if exists benchmarkAppList;
+create table benchmarkAppList (
+  benchmarkAppList_id integer primary key autoincrement,
+  --Type: either game or non-game
+  benchmarkAppList_type text,
+  benchmarkAppList_name text,
+  benchmarkAppList_desc text
+);
+
+
+
+INSERT INTO user 
+        (user_name, 
+        user_password) 
+        VALUES ("admin",
+                "testing");
+/* INSERT INTO pcPart 
+        (pcPart_type, 
+        pcPart_name, 
+        pcPart_modelNumber) 
+        VALUES ("psu",
+                "Antec 500W",
+                "AN500W");
+INSERT INTO psu 
+        (psu_watt, 
+        psu_effiency, 
+        psu_pcPart_id) 
+        VALUES (500,
+                "80plus",
+                1);
+                
+                
+INSERT INTO pcPart 
+        (pcPart_type, 
+        pcPart_name, 
+        pcPart_modelNumber) 
+        VALUES ("psu",
+                "Thermaltake 750W",
+                "TT750W");
+INSERT INTO psu 
+        (psu_watt, 
+        psu_effiency, 
+        psu_pcPart_id) 
+        VALUES (750,
+                "titanium",
+                2);
+                
+INSERT INTO pcBuild 
+        (pcBuild_name, 
+        pcBuild_type, 
+        pcBuild_ssd_id) 
+        VALUES ("Test PC Build",
+                "Gaming",
+                1); */
+                
+                
\ No newline at end of file
diff --git a/flaskr/static/style.css b/flaskr/static/style.css
new file mode 100644 (file)
index 0000000..93623a4
--- /dev/null
@@ -0,0 +1,26 @@
+html { font-family: sans-serif; background: #eee; padding: 1rem; }
+body { max-width: 960px; margin: 0 auto; background: white; }
+h1 { font-family: serif; color: #377ba8; margin: 1rem 0; }
+a { color: #377ba8; }
+hr { border: none; border-top: 1px solid lightgray; }
+nav { background: lightgray; display: flex; align-items: center; padding: 0 0.5rem; }
+nav h1 { flex: auto; margin: 0; }
+nav h1 a { text-decoration: none; padding: 0.25rem 0.5rem; }
+nav ul  { display: flex; list-style: none; margin: 0; padding: 0; }
+nav ul li a, nav ul li span, header .action { display: block; padding: 0.5rem; }
+.content { padding: 0 1rem 1rem; }
+.content > header { border-bottom: 1px solid lightgray; display: flex; align-items: flex-end; }
+.content > header h1 { flex: auto; margin: 1rem 0 0.25rem 0; }
+.flash { margin: 1em 0; padding: 1em; background: #cae6f6; border: 1px solid #377ba8; }
+.post > header { display: flex; align-items: flex-end; font-size: 0.85em; }
+.post > header > div:first-of-type { flex: auto; }
+.post > header h1 { font-size: 1.5em; margin-bottom: 0; }
+.post .about { color: slategray; font-style: italic; }
+.post .body { white-space: pre-line; }
+.content:last-child { margin-bottom: 0; }
+.content form { margin: 1em 0; display: flex; flex-direction: column; }
+.content label { font-weight: bold; margin-bottom: 0.5em; }
+.content input, .content textarea { margin-bottom: 1em; }
+.content textarea { min-height: 12em; resize: vertical; }
+input.danger { color: #cc2f2e; }
+input[type=submit] { align-self: start; min-width: 10em; }
\ No newline at end of file
diff --git a/flaskr/templates/auth/login.html b/flaskr/templates/auth/login.html
new file mode 100644 (file)
index 0000000..b7dd5dc
--- /dev/null
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}Log In{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+  <form method="post">
+    <label for="username">Username</label>
+    <input name="username" id="username" required>
+    <label for="password">Password</label>
+    <input type="password" name="password" id="password" required>
+    <input type="submit" value="Log In">
+  </form>
+{% endblock %}
\ No newline at end of file
diff --git a/flaskr/templates/auth/register.html b/flaskr/templates/auth/register.html
new file mode 100644 (file)
index 0000000..a3c73cc
--- /dev/null
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}Register{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+  <form method="post">
+    <label for="username">Username</label>
+    <input name="username" id="username" required>
+    <label for="password">Password</label>
+    <input type="password" name="password" id="password" required>
+    <input type="submit" value="Register">
+  </form>
+{% endblock %}
\ No newline at end of file
diff --git a/flaskr/templates/base.html b/flaskr/templates/base.html
new file mode 100644 (file)
index 0000000..ed9a4f9
--- /dev/null
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>{% block title %}{% endblock %} - Flaskr</title>
+<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
+<nav>
+  <h1>Flaskr</h1>
+  <ul>
+    <a href="{{ url_for('dashboard.index') }}">Visit Dashboard</a>
+    {% if g.user %}
+      <li><span>{{ g.user['user_name'] }}</span>
+      <li><a href="{{ url_for('auth.logout') }}">Log Out</a>
+    {% else %}
+      <li><a href="{{ url_for('auth.register') }}">Register</a>
+      <li><a href="{{ url_for('auth.login') }}">Log In</a>
+    {% endif %}
+  </ul>
+</nav>
+<section class="content">
+  <header>
+    {% block header %}{% endblock %}
+  </header>
+  {% for message in get_flashed_messages() %}
+    <div class="flash">{{ message }}</div>
+  {% endfor %}
+  {% block content %}{% endblock %}
+</section>
\ No newline at end of file
diff --git a/flaskr/templates/blog/create.html b/flaskr/templates/blog/create.html
new file mode 100644 (file)
index 0000000..ad402e0
--- /dev/null
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}New Post{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+  <form method="post">
+    <label for="title">Title</label>
+    <input name="title" id="title" value="{{ request.form['title'] }}" required>
+    <label for="body">Body</label>
+    <textarea name="body" id="body">{{ request.form['body'] }}</textarea>
+    <input type="submit" value="Save">
+  </form>
+{% endblock %}
\ No newline at end of file
diff --git a/flaskr/templates/blog/index.html b/flaskr/templates/blog/index.html
new file mode 100644 (file)
index 0000000..77c0693
--- /dev/null
@@ -0,0 +1,28 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}Posts{% endblock %}</h1>
+  {% if g.user %}
+    <a class="action" href="{{ url_for('blog.create') }}">New</a>
+  {% endif %}
+{% endblock %}
+
+{% block content %}
+  {% for post in posts %}
+    <article class="post">
+      <header>
+        <div>
+          <h1>{{ post['post_title'] }}</h1>
+          <div class="about">by {{ post['user_name'] }} on {{ post['post_created'].strftime('%Y-%m-%d') }}</div>
+        </div>
+        {% if g.user['id'] == post['post_author_id'] %}
+          <a class="action" href="{{ url_for('blog.update', id=post['post_id']) }}">Edit</a>
+        {% endif %}
+      </header>
+      <p class="body">{{ post['post_body'] }}</p>
+    </article>
+    {% if not loop.last %}
+      <hr>
+    {% endif %}
+  {% endfor %}
+{% endblock %}
\ No newline at end of file
diff --git a/flaskr/templates/blog/update.html b/flaskr/templates/blog/update.html
new file mode 100644 (file)
index 0000000..fde2acc
--- /dev/null
@@ -0,0 +1,20 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}Edit "{{ post['title'] }}"{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+  <form method="post">
+    <label for="title">Title</label>
+    <input name="title" id="title"
+      value="{{ request.form['title'] or post['title'] }}" required>
+    <label for="body">Body</label>
+    <textarea name="body" id="body">{{ request.form['body'] or post['body'] }}</textarea>
+    <input type="submit" value="Save">
+  </form>
+  <hr>
+  <form action="{{ url_for('blog.delete', id=post['post_id']) }}" method="post">
+    <input class="danger" type="submit" value="Delete" onclick="return confirm('Are you sure?');">
+  </form>
+{% endblock %}
\ No newline at end of file
diff --git a/flaskr/templates/dashboard.html b/flaskr/templates/dashboard.html
new file mode 100644 (file)
index 0000000..d1a4bac
--- /dev/null
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+{% block content %}
+
+                <h1>Dashboard</h1>
+                <b>Landing Page</b>
+                <em>Welcome to the dashboard!</em>
+                </br>
+                <em>New Stuff</em>
+                </br>
+                <a href="{{ url_for('blog.index') }}">Visit Blog</a>
+                </br>
+                </br>
+{% endblock %}
\ No newline at end of file
diff --git a/instance/flaskr.sqlite b/instance/flaskr.sqlite
new file mode 100644 (file)
index 0000000..7af9d97
Binary files /dev/null and b/instance/flaskr.sqlite differ
diff --git a/schema.sql b/schema.sql
deleted file mode 100644 (file)
index cadc078..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
---Users table
-drop table if exists user;
-create table user (
-  user_id integer primary key autoincrement,
-  user_name text not null,
-  user_password text not null
-);
---Basic info about an item
-drop table if exists item;
-create table item (
-  item_id integer primary key autoincrement,
-  item_name text,
-  item_subtitle text,
-  item_desc text,
-  item_category text,
-  item_condition text,
-  item_conditionDesc text,
-  item_cost numeric,
-  item_returnPolicyDesc text,
-  item_insertDate datetime
-);
-
-
---File Upload/Download Data
-drop table if exists file;
-create table file (
-  file_id integer primary key autoincrement,
-  file_name text,
-  file_path text,
-  file_size numeric,
-  file_today_date text
-);
---Settings Data
-drop table if exists settings;
-create table settings (
-  settings_id integer primary key autoincrement,
-  settings_uploadFilePath text
-);
-
-INSERT INTO settings (settings_uploadFilePath) VALUES ('c:/Users/Joseph/Downloads/Media_Server_Upload');
-
-
-
---Item Condition for a particular item
-drop table if exists itemCondition;
-create table itemCondition (
-  itemCondition_id integer primary key autoincrement,
-  itemCondition_name text
-);
---Shipping info for a particular item
-drop table if exists itemShipping;
-create table itemShipping (
-  itemShipping_id integer primary key autoincrement,
-  itemShipping_method text,
-  itemShipping_weight numeric,
-  itemShipping_boxType text,
-  itemShipping_boxWidth numeric,
-  itemShipping_boxHeight numeric,
-  itemShipping_boxLength numeric,
-  itemShipping_handlingDuration datetime,
-  itemShipping_itemLocation text,
-  itemShipping_item_id integer,
-  FOREIGN KEY(itemShipping_item_id) REFERENCES item(item_id)
-);
---Pictures for a particular item
-drop table if exists itemPicture;
-create table itemPicture (
-  itemPicture_id integer primary key autoincrement,
-  itemPicture_data blob,
-  itemPicture_caption text,
-  itemPicture_item_id integer,
-  FOREIGN KEY(itemPicture_item_id) REFERENCES item(item_id)
-);
---Metrics for a particular item (will need to allow for adding new specs on the fly)
-drop table if exists itemSpecs;
-create table itemSpecs (
-  itemSpecs_id integer primary key autoincrement,
-  itemSpecs_name text,
-  itemSpecs_value text,
-  itemSpecs_item_id integer,
-  FOREIGN KEY(itemSpecs_item_id) REFERENCES item(item_id)
-);
---Ebay-specific Item Data
-drop table if exists itemEbay;
-create table itemEbay (
-  itemEbay_id integer primary key autoincrement,
-  itemEbay_bid text,
-  itemEbay_buyItNow numeric,
-  itemEbay_reservePrice numeric,
-  itemEbay_fpQuantity integer,
-  itemEbay_fpBestOffer numeric,
-  itemEbay_fpMin numeric,
-  itemEbay_fpMax numeric,
-  itemEbay_duration datetime,
-  itemEbay_insertionFee numeric,
-  itemEbay_tax numeric,
-  itemEbay_item_id integer,
-  FOREIGN KEY(itemEbay_item_id) REFERENCES item(item_id)
-);
---Table of PC Builds
-drop table if exists pcBuild;
-create table pcBuild (
-  pcBuild_id integer primary key autoincrement,
-  pcBuild_name text,
-  pcBuild_type text,
-  pcBuild_notes text,
-  pcBuild_avgPartAge numeric,
-  pcBuild_mobo_id integer,
-  pcBuild_case_id integer,
-  pcBuild_ram_id integer,
-  pcBuild_gpu_id integer,
-  pcBuild_ssd_id integer,
-  pcBuild_hdd_id integer,
-  pcBuild_cpu_id integer,
-  pcBuild_psu_id integer,
-  pcBuild_cpuCool_id integer,
-  pcBuild_fan_id integer,
-  pcBuild_ledkit_id integer,
-  pcBuild_os_id integer,
-  pcBuild_colorScheme text
-);
---General PC Part Info
-drop table if exists pcPart;
-create table pcPart (
-  pcPart_id integer primary key autoincrement,
-  pcPart_type text,
-  pcPart_name text,
-  pcPart_modelNumber text,
-  pcPart_price numeric,
-  pcPart_desc text,
-  pcPart_brand text,
-  pcPart_condition text,
-  pcPart_notes text,
-  pcPart_age integer,
-  pcPart_pcBuild_id integer
-);
---RAM Part-Specific Info
-drop table if exists ram;
-create table ram (
-  ram_id integer primary key autoincrement,
-  ram_kitSize text,
-  ram_stickSize integer,
-  ram_speed integer,
-  ram_type text,
-  ram_casLatency text,
-  ram_pcPart_id integer,
-  FOREIGN KEY(ram_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Solid State Drive Part-Specific Info
-drop table if exists ssd;
-create table ssd (
-  ssd_id integer primary key autoincrement,
-  ssd_formFactor text,
-  ssd_size integer,
-  ssd_interface text,
-  ssd_pcPart_id integer,
-  FOREIGN KEY(ssd_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
-
---HDD Part-Specific Info
-drop table if exists hdd;
-create table hdd (
-  hdd_id integer primary key autoincrement,
-  hdd_formFactor text,
-  hdd_size integer,
-  hdd_interface text,
-  hdd_cache integer,
-  hdd_rpm integer,
-  hdd_pcPart_id integer,
-  FOREIGN KEY(hdd_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Case Part-Specific Info
-drop table if exists cases;
-create table cases (
-  case_id integer primary key autoincrement,
-  case_formFactor text,
-  case_width numeric,
-  case_height numeric,
-  case_length numeric,
-  case_525bay integer,
-  case_350bay integer,
-  case_250bay integer,
-  case_80fan integer,
-  case_120fan integer,
-  case_140fan integer,
-  case_240fan integer,
-  case_otherFan text,
-  case_fpSpk integer,
-  case_fpMic integer,
-  case_fpUSB3 integer,
-  case_fpUSB2 integer,
-  case_psuSlots integer,
-  case_waterSlots text,
-  case_pcPart_id integer,
-  FOREIGN KEY(case_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Video Card Part-Specific Info
-drop table if exists gpu;
-create table gpu (
-  gpu_id integer primary key autoincrement,
-  gpu_vramType text,
-  gpu_vramSize text,
-  gpu_slotWidth text,
-  gpu_interface text,
-  gpu_6pin integer,
-  gpu_8pin integer,
-  gpu_clockSpeed numeric,
-  gpu_memClockSpeed numeric,
-  gpu_busBandwidth numeric,
-  gpu_crossfire integer,
-  gpu_sli integer,
-  gpu_pcPart_id integer,
-  FOREIGN KEY(gpu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Power Supply Part-Specific Info
-drop table if exists psu;
-create table psu (
-  psu_id integer primary key autoincrement,
-  psu_watt integer,
-  psu_effiency text,
-  psu_8pin integer,
-  psu_6pin integer,
-  psu_4pin integer,
-  psu_molex integer,
-  psu_sata integer,
-  psu_floppy integer,
-  psu_pcPart_id integer,
-  FOREIGN KEY(psu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Operating System Part-Specific Info
-drop table if exists os;
-create table os (
-  os_id integer primary key autoincrement,
-  os_type text,
-  os_bit integer,
-  os_version text,
-  os_pcPart_id integer,
-  FOREIGN KEY(os_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---CPU Cooler Part-Specific Info
-drop table if exists cpuCool;
-create table cpuCool (
-  cpuCool_id integer primary key autoincrement,
-  cpuCool_type text,
-  cpuCool_socketList text,
-  cpuCool_fanCount integer,
-  cpuCool_fanSize text,
-  cpuCool_pcPart_id integer,
-  FOREIGN KEY(cpuCool_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Motherboard Part-Specific Info
-drop table if exists mobo;
-create table mobo (
-  mobo_id integer primary key autoincrement,
-  mobo_ramType text,
-  mobo_CPUsocket text,
-  mobo_dimmSlots integer,
-  mobo_pciSlots integer,
-  mobo_pcie16Slots integer,
-  mobo_pcie8Slots integer,
-  mobo_pcie4Slots integer,
-  mobo_pcie1Slots integer,
-  mobo_chipset text,
-  mobo_cpu4pin integer,
-  mobo_cpu8pin integer,
-  mobo_cpu6pin integer,
-  mobo_pcPart_id integer,
-  FOREIGN KEY(mobo_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---Case Fans Part-Specific Info
-drop table if exists fan;
-create table fan (
-  fan_id integer primary key autoincrement,
-  fan_size integer,
-  fan_type text,
-  fan_color text,
-  fan_pcPart_id integer,
-  FOREIGN KEY(fan_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---LED Kits Part-Specific Info
-drop table if exists ledkit;
-create table ledkit (
-  ledkit_id integer primary key autoincrement,
-  ledkit_color text,
-  ledkit_type text,
-  ledkit_notes text,
-  ledkit_pcPart_id integer,
-  FOREIGN KEY(ledkit_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
---CPU Part-Specific Info
-drop table if exists cpu;
-create table cpu (
-  cpu_id integer primary key autoincrement,
-  cpu_socket text,
-  cpu_cores integer,
-  cpu_threads integer,
-  cpu_frequency numeric,
-  cpu_cache integer,
-  cpu_wattage integer,
-  cpu_pcPart_id integer,
-  FOREIGN KEY(cpu_pcPart_id) REFERENCES pcPart(pcPart_id) ON DELETE CASCADE
-);
-
-
-
---Benchmark general data for a particular PC
-drop table if exists pcBenchmark;
-create table pcBenchmark (
-  pcBenchmark_id integer primary key autoincrement,
-  pcBenchmark_notes text,
-  pcBenchmark_score text,
-  pcBenchmark_fps text,
-  pcBenchmark_pcBuild_id integer,
-  FOREIGN KEY(pcBenchmark_pcBuild_id) REFERENCES pcBuild(pcBuild_id)
-);
-
---Picture storage for a particular PC's benchmarks
-drop table if exists pcBenchmarkPictures;
-create table pcBenchmarkPictures (
-  pcBenchmarkPictures_id integer primary key autoincrement,
-  pcBenchmarkPictures_data blob,
-  pcBenchmarkPictures_pcBenchmark_id integer,
-  FOREIGN KEY(pcBenchmarkPictures_pcBenchmark_id) REFERENCES pcBenchmark(pcBenchmark_id)
-);
-
---List of applications / games available for selection
-drop table if exists benchmarkAppList;
-create table benchmarkAppList (
-  benchmarkAppList_id integer primary key autoincrement,
-  --Type: either game or non-game
-  benchmarkAppList_type text,
-  benchmarkAppList_name text,
-  benchmarkAppList_desc text
-);
-
-
-
-INSERT INTO user 
-        (user_name, 
-        user_password) 
-        VALUES ("admin",
-                "testing");
-/* INSERT INTO pcPart 
-        (pcPart_type, 
-        pcPart_name, 
-        pcPart_modelNumber) 
-        VALUES ("psu",
-                "Antec 500W",
-                "AN500W");
-INSERT INTO psu 
-        (psu_watt, 
-        psu_effiency, 
-        psu_pcPart_id) 
-        VALUES (500,
-                "80plus",
-                1);
-                
-                
-INSERT INTO pcPart 
-        (pcPart_type, 
-        pcPart_name, 
-        pcPart_modelNumber) 
-        VALUES ("psu",
-                "Thermaltake 750W",
-                "TT750W");
-INSERT INTO psu 
-        (psu_watt, 
-        psu_effiency, 
-        psu_pcPart_id) 
-        VALUES (750,
-                "titanium",
-                2);
-                
-INSERT INTO pcBuild 
-        (pcBuild_name, 
-        pcBuild_type, 
-        pcBuild_ssd_id) 
-        VALUES ("Test PC Build",
-                "Gaming",
-                1); */
-                
-                
\ No newline at end of file
diff --git a/static/style.css b/static/style.css
deleted file mode 100644 (file)
index 2ea1303..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-body            { font-family: sans-serif; background: #C29A97; }
-/*body            { margin-left: 10%; margin-right: 10%; font-family: sans-serif; background: #eee; }
-a, h1, h2       { color: #377ba8; } */
-a, h1, h2       { color: blue; }
-h1, h2          { font-family: 'Georgia', serif; margin: 0; }
-h1              { border-bottom: 2px solid #eee; }
-h2              { font-size: 1.2em; }
-
-/*
-.page           { margin: 2em auto; width: 35em; border: 5px solid #ccc;
-                   padding: 0.8em; background: white; }
-*/
-.page           { margin: 2em auto; width: auto; border: 5px solid #ccc;
-                   padding: 0.8em; background: #EEE8BC; }
-.items        { list-style: none; margin: 0; padding: 0; }
-.items li     { margin: 0.8em 1.2em; }
-.items li h2  { margin-left: -1em; }
-.add-item      { font-size: 0.9em; border-bottom: 1px solid #ccc; }
-.add-item dl   { font-weight: bold; }
-.metanav        { text-align: right; font-size: 0.8em; padding: 0.3em;
-                  margin-bottom: 1em; background: #fafafa; }
-.flash          { background: #cee5F5; padding: 0.5em;
-                  border: 1px solid #aacbe2; }
-.error          { background: #f0d6d6; padding: 0.5em; }
-
-
-
-/* Style the list */
-ul.tab {
-    list-style-type: none;
-    margin: 0;
-    padding: 0;
-    overflow: hidden;
-    border: 1px solid #ccc;
-    background-color: #f1f1f1;
-}
-
-/* Float the list items side by side */
-ul.tab li {float: left;}
-
-/* Style the links inside the list items */
-ul.tab li a {
-    display: inline-block;
-    color: black;
-    text-align: center;
-    padding: 14px 16px;
-    text-decoration: none;
-    transition: 0.3s;
-    font-size: 17px;
-}
-
-
diff --git a/static/style2.css b/static/style2.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/templates/base.html b/templates/base.html
new file mode 100644 (file)
index 0000000..fb0e460
--- /dev/null
@@ -0,0 +1,24 @@
+<!doctype html>
+<title>{% block title %}{% endblock %} - Flaskr</title>
+<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
+<nav>
+  <h1>Flaskr</h1>
+  <ul>
+    {% if g.user %}
+      <li><span>{{ g.user['username'] }}</span>
+      <li><a href="{{ url_for('auth.logout') }}">Log Out</a>
+    {% else %}
+      <li><a href="{{ url_for('auth.register') }}">Register</a>
+      <li><a href="{{ url_for('auth.login') }}">Log In</a>
+    {% endif %}
+  </ul>
+</nav>
+<section class="content">
+  <header>
+    {% block header %}{% endblock %}
+  </header>
+  {% for message in get_flashed_messages() %}
+    <div class="flash">{{ message }}</div>
+  {% endfor %}
+  {% block content %}{% endblock %}
+</section>
\ No newline at end of file
index 4b4fd010aef7dea1a42b657c2f5e4d6b9e645500..e1022c816fc1a89c4b8d4779052c452dc7d91ab3 100644 (file)
@@ -1,5 +1,6 @@
 {% extends "layout.html" %}
 {% block body %}
+
         <ul class=items>
                 <li><h2>Dashboard</h2>
                 <li><b>Landing Page</b>
@@ -13,6 +14,7 @@
                 </br>
                 <a href="{{ url_for('mediaserver_settings') }}">Settings</a>
                 </br>
+                <a href="{{ url_for('register') }}">Upload a File</a>
                 </br>
         </ul>
 {% endblock %}
\ No newline at end of file
diff --git a/templates/register.html b/templates/register.html
new file mode 100644 (file)
index 0000000..a3c73cc
--- /dev/null
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block header %}
+  <h1>{% block title %}Register{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+  <form method="post">
+    <label for="username">Username</label>
+    <input name="username" id="username" required>
+    <label for="password">Password</label>
+    <input type="password" name="password" id="password" required>
+    <input type="submit" value="Register">
+  </form>
+{% endblock %}
\ No newline at end of file