From 6946216966df64c811f34b2fd77c89a65ed9cfe9 Mon Sep 17 00:00:00 2001 From: jonasled <jonas@jonasled.de> Date: Mon, 21 Oct 2019 10:44:51 +0200 Subject: [PATCH] removed ID from Table, better for extreme big databases and not needed --- export.py | 4 ++-- import.py | 4 ++-- main.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/export.py b/export.py index 70ad0f6..28dacbe 100644 --- a/export.py +++ b/export.py @@ -6,8 +6,8 @@ import sqlite3 create_table = """ CREATE TABLE WEB_URL( - ID INTEGER PRIMARY KEY AUTOINCREMENT, - LONG_URL TEXT NOT NULL, SHORT_URL TEXT NOT NULL + LONG_URL TEXT NOT NULL + SHORT_URL TEXT NOT NULL ); """ with sqlite3.connect('db/urls.db') as conn: diff --git a/import.py b/import.py index 976ce4b..fc908c5 100644 --- a/import.py +++ b/import.py @@ -7,8 +7,8 @@ from tqdm import tqdm def table_check(): #Check if database exists create_table = """ CREATE TABLE WEB_URL( - ID INTEGER PRIMARY KEY AUTOINCREMENT, - LONG_URL TEXT NOT NULL, SHORT_URL TEXT NOT NULL + LONG_URL TEXT NOT NULL, + SHORT_URL TEXT NOT NULL ); """ with sqlite3.connect('db/urls.db') as conn: diff --git a/main.py b/main.py index 99f40b3..35e92ea 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ domain_to_index = {} domain_prepared = "" try: - domain = os.environ["domains"].split(";") #Get the domains from the enviorement variable. If no envioremenr variable is set set it to 127.0.0.1:5000 (for testing) + domain = os.environ["domains"].split(";") #Get the domains from the enviorement variable. If no enviorement variable is set set it to 127.0.0.1:5000 (for testing) except: domain = ["127.0.0.1:5000"] @@ -24,7 +24,7 @@ except: pass #This exception is only to pass it while testing try: - if(os.environ["production"] == "1"): #If you use this in production, please set this to 1, because the Flask Testserver is not very secure + if(os.environ["production"] == "1"): #If you use this in production, please set this to 1, because the Flask Testserver is not very secure (e.g. shows error on Website) production = True else: production = False @@ -42,8 +42,8 @@ for domains in domain: #Make from every domnain a entry for the select box later def table_check(): create_table = """ CREATE TABLE WEB_URL( - ID INTEGER PRIMARY KEY AUTOINCREMENT, - LONG_URL TEXT NOT NULL, SHORT_URL TEXT NOT NULL + LONG_URL TEXT NOT NULL, + SHORT_URL TEXT NOT NULL ); """ with sqlite3.connect('db/urls.db') as conn: -- GitLab