Skip to content

Commit a8aeab3

Browse files
committed
Initialized dev env
1 parent 019ee08 commit a8aeab3

File tree

6 files changed

+304
-0
lines changed

6 files changed

+304
-0
lines changed

app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from app import app

app/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
from app import routes

app/routes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import render_template
2+
from app import app
3+
4+
@app.route('/')
5+
def index():
6+
return render_template('base.html')
7+
8+
@app.route('/question')
9+
def question():
10+
return render_template('index.html')

app/templates/base.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<!-- <head>
3+
{% if title %}
4+
<title>{{ title }} - Microblog</title>
5+
{% else %}
6+
<title>Welcome to Microblog</title>
7+
{% endif %}
8+
</head> -->
9+
<body>
10+
<p>Header</p>
11+
{% block content %}{% endblock %}
12+
<p>Footer</p>
13+
</body>
14+
</html>

app/templates/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<p>Middle text</p>
5+
{% endblock %}

db.sql

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
-- MySQL dump 10.13 Distrib 8.0.16, for Linux (x86_64)
2+
--
3+
-- Host: localhost Database: QAproject
4+
-- ------------------------------------------------------
5+
-- Server version 8.0.16
6+
7+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10+
SET NAMES utf8mb4 ;
11+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12+
/*!40103 SET TIME_ZONE='+00:00' */;
13+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17+
18+
--
19+
-- Table structure for table `Answer`
20+
--
21+
22+
DROP TABLE IF EXISTS `Answer`;
23+
/*!40101 SET @saved_cs_client = @@character_set_client */;
24+
SET character_set_client = utf8mb4 ;
25+
CREATE TABLE `Answer` (
26+
`answer_id` int(11) NOT NULL,
27+
`upvotes` int(11) DEFAULT '0',
28+
`downvotes` int(11) DEFAULT '0',
29+
`answered_at` timestamp NULL DEFAULT NULL,
30+
`content` blob,
31+
`is_solution` int(11) DEFAULT '0',
32+
`question_id` int(11) NOT NULL,
33+
`userid` int(11) NOT NULL,
34+
PRIMARY KEY (`question_id`,`answer_id`),
35+
KEY `userid` (`userid`),
36+
CONSTRAINT `Answer_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `Question` (`question_id`) ON DELETE CASCADE,
37+
CONSTRAINT `Answer_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `User` (`userid`) ON DELETE CASCADE
38+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
39+
/*!40101 SET character_set_client = @saved_cs_client */;
40+
41+
--
42+
-- Dumping data for table `Answer`
43+
--
44+
45+
LOCK TABLES `Answer` WRITE;
46+
/*!40000 ALTER TABLE `Answer` DISABLE KEYS */;
47+
/*!40000 ALTER TABLE `Answer` ENABLE KEYS */;
48+
UNLOCK TABLES;
49+
50+
--
51+
-- Table structure for table `Answer_Upvotes`
52+
--
53+
54+
DROP TABLE IF EXISTS `Answer_Upvotes`;
55+
/*!40101 SET @saved_cs_client = @@character_set_client */;
56+
SET character_set_client = utf8mb4 ;
57+
CREATE TABLE `Answer_Upvotes` (
58+
`question_id` int(11) NOT NULL,
59+
`answer_id` int(11) NOT NULL,
60+
`userid` int(11) NOT NULL,
61+
PRIMARY KEY (`question_id`,`answer_id`,`userid`),
62+
KEY `userid` (`userid`),
63+
CONSTRAINT `Answer_Upvotes_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `Question` (`question_id`),
64+
CONSTRAINT `Answer_Upvotes_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `User` (`userid`)
65+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
66+
/*!40101 SET character_set_client = @saved_cs_client */;
67+
68+
--
69+
-- Dumping data for table `Answer_Upvotes`
70+
--
71+
72+
LOCK TABLES `Answer_Upvotes` WRITE;
73+
/*!40000 ALTER TABLE `Answer_Upvotes` DISABLE KEYS */;
74+
/*!40000 ALTER TABLE `Answer_Upvotes` ENABLE KEYS */;
75+
UNLOCK TABLES;
76+
77+
--
78+
-- Table structure for table `Moderator`
79+
--
80+
81+
DROP TABLE IF EXISTS `Moderator`;
82+
/*!40101 SET @saved_cs_client = @@character_set_client */;
83+
SET character_set_client = utf8mb4 ;
84+
CREATE TABLE `Moderator` (
85+
`email` varchar(40) NOT NULL,
86+
`moderator_since` timestamp NULL DEFAULT NULL,
87+
PRIMARY KEY (`email`),
88+
CONSTRAINT `Moderator_ibfk_1` FOREIGN KEY (`email`) REFERENCES `User` (`email`)
89+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
90+
/*!40101 SET character_set_client = @saved_cs_client */;
91+
92+
--
93+
-- Dumping data for table `Moderator`
94+
--
95+
96+
LOCK TABLES `Moderator` WRITE;
97+
/*!40000 ALTER TABLE `Moderator` DISABLE KEYS */;
98+
/*!40000 ALTER TABLE `Moderator` ENABLE KEYS */;
99+
UNLOCK TABLES;
100+
101+
--
102+
-- Table structure for table `Question`
103+
--
104+
105+
DROP TABLE IF EXISTS `Question`;
106+
/*!40101 SET @saved_cs_client = @@character_set_client */;
107+
SET character_set_client = utf8mb4 ;
108+
CREATE TABLE `Question` (
109+
`question_id` int(11) NOT NULL,
110+
`status` int(11) DEFAULT NULL,
111+
`upvotes` int(11) DEFAULT '0',
112+
`downvotes` int(11) DEFAULT '0',
113+
`asked_at` timestamp NULL DEFAULT NULL,
114+
`content` blob,
115+
`userid` int(11) NOT NULL,
116+
PRIMARY KEY (`question_id`),
117+
KEY `userid` (`userid`),
118+
CONSTRAINT `Question_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `User` (`userid`) ON DELETE CASCADE
119+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
120+
/*!40101 SET character_set_client = @saved_cs_client */;
121+
122+
--
123+
-- Dumping data for table `Question`
124+
--
125+
126+
LOCK TABLES `Question` WRITE;
127+
/*!40000 ALTER TABLE `Question` DISABLE KEYS */;
128+
/*!40000 ALTER TABLE `Question` ENABLE KEYS */;
129+
UNLOCK TABLES;
130+
131+
--
132+
-- Table structure for table `Question_Upvotes`
133+
--
134+
135+
DROP TABLE IF EXISTS `Question_Upvotes`;
136+
/*!40101 SET @saved_cs_client = @@character_set_client */;
137+
SET character_set_client = utf8mb4 ;
138+
CREATE TABLE `Question_Upvotes` (
139+
`question_id` int(11) NOT NULL,
140+
`userid` int(11) NOT NULL,
141+
PRIMARY KEY (`question_id`,`userid`),
142+
KEY `userid` (`userid`),
143+
CONSTRAINT `Question_Upvotes_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `Question` (`question_id`) ON DELETE CASCADE,
144+
CONSTRAINT `Question_Upvotes_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `User` (`userid`)
145+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
146+
/*!40101 SET character_set_client = @saved_cs_client */;
147+
148+
--
149+
-- Dumping data for table `Question_Upvotes`
150+
--
151+
152+
LOCK TABLES `Question_Upvotes` WRITE;
153+
/*!40000 ALTER TABLE `Question_Upvotes` DISABLE KEYS */;
154+
/*!40000 ALTER TABLE `Question_Upvotes` ENABLE KEYS */;
155+
UNLOCK TABLES;
156+
157+
--
158+
-- Table structure for table `Tag`
159+
--
160+
161+
DROP TABLE IF EXISTS `Tag`;
162+
/*!40101 SET @saved_cs_client = @@character_set_client */;
163+
SET character_set_client = utf8mb4 ;
164+
CREATE TABLE `Tag` (
165+
`Tagname` char(10) NOT NULL,
166+
`question_count` int(11) DEFAULT '0',
167+
PRIMARY KEY (`Tagname`)
168+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
169+
/*!40101 SET character_set_client = @saved_cs_client */;
170+
171+
--
172+
-- Dumping data for table `Tag`
173+
--
174+
175+
LOCK TABLES `Tag` WRITE;
176+
/*!40000 ALTER TABLE `Tag` DISABLE KEYS */;
177+
/*!40000 ALTER TABLE `Tag` ENABLE KEYS */;
178+
UNLOCK TABLES;
179+
180+
--
181+
-- Table structure for table `Tag_relation`
182+
--
183+
184+
DROP TABLE IF EXISTS `Tag_relation`;
185+
/*!40101 SET @saved_cs_client = @@character_set_client */;
186+
SET character_set_client = utf8mb4 ;
187+
CREATE TABLE `Tag_relation` (
188+
`Tagname1` char(10) NOT NULL,
189+
`Tagname2` char(10) NOT NULL,
190+
PRIMARY KEY (`Tagname1`,`Tagname2`),
191+
KEY `Tagname2` (`Tagname2`),
192+
CONSTRAINT `Tag_relation_ibfk_1` FOREIGN KEY (`Tagname1`) REFERENCES `Tag` (`Tagname`) ON DELETE CASCADE,
193+
CONSTRAINT `Tag_relation_ibfk_2` FOREIGN KEY (`Tagname2`) REFERENCES `Tag` (`Tagname`) ON DELETE CASCADE
194+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
195+
/*!40101 SET character_set_client = @saved_cs_client */;
196+
197+
--
198+
-- Dumping data for table `Tag_relation`
199+
--
200+
201+
LOCK TABLES `Tag_relation` WRITE;
202+
/*!40000 ALTER TABLE `Tag_relation` DISABLE KEYS */;
203+
/*!40000 ALTER TABLE `Tag_relation` ENABLE KEYS */;
204+
UNLOCK TABLES;
205+
206+
--
207+
-- Table structure for table `Tagged`
208+
--
209+
210+
DROP TABLE IF EXISTS `Tagged`;
211+
/*!40101 SET @saved_cs_client = @@character_set_client */;
212+
SET character_set_client = utf8mb4 ;
213+
CREATE TABLE `Tagged` (
214+
`Tagname` char(10) NOT NULL,
215+
`question_id` int(11) NOT NULL,
216+
PRIMARY KEY (`Tagname`,`question_id`),
217+
KEY `question_id` (`question_id`),
218+
CONSTRAINT `Tagged_ibfk_1` FOREIGN KEY (`Tagname`) REFERENCES `Tag` (`Tagname`) ON DELETE CASCADE,
219+
CONSTRAINT `Tagged_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `Question` (`question_id`) ON DELETE CASCADE
220+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
221+
/*!40101 SET character_set_client = @saved_cs_client */;
222+
223+
--
224+
-- Dumping data for table `Tagged`
225+
--
226+
227+
LOCK TABLES `Tagged` WRITE;
228+
/*!40000 ALTER TABLE `Tagged` DISABLE KEYS */;
229+
/*!40000 ALTER TABLE `Tagged` ENABLE KEYS */;
230+
UNLOCK TABLES;
231+
232+
--
233+
-- Table structure for table `User`
234+
--
235+
236+
DROP TABLE IF EXISTS `User`;
237+
/*!40101 SET @saved_cs_client = @@character_set_client */;
238+
SET character_set_client = utf8mb4 ;
239+
CREATE TABLE `User` (
240+
`email` varchar(40) NOT NULL,
241+
`password` varchar(40) NOT NULL,
242+
`username` varchar(20) DEFAULT NULL,
243+
`userid` int(11) DEFAULT NULL,
244+
`reputation` int(11) DEFAULT '0',
245+
`user_since` timestamp NULL DEFAULT NULL,
246+
PRIMARY KEY (`email`),
247+
UNIQUE KEY `userid` (`userid`)
248+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
249+
/*!40101 SET character_set_client = @saved_cs_client */;
250+
251+
--
252+
-- Dumping data for table `User`
253+
--
254+
255+
LOCK TABLES `User` WRITE;
256+
/*!40000 ALTER TABLE `User` DISABLE KEYS */;
257+
/*!40000 ALTER TABLE `User` ENABLE KEYS */;
258+
UNLOCK TABLES;
259+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
260+
261+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
262+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
263+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
264+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
265+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
266+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
267+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
268+
269+
-- Dump completed on 2019-05-08 2:17:58

0 commit comments

Comments
 (0)