#!venv/bin/python import sqlite3 import os.path def init_db(): if os.path.isfile('base.db'): return False else: conn = sqlite3.connect('base.db') cursor = conn.cursor() cursor.execute(""" CREATE TABLE IF NOT EXISTS users( id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, name TEXT, mail TEXT, passwd TEXT, avatar TEXT, nom, TEXT, prenom TEXT, age TEXT, profession TEXT ) """) conn.commit() print ('table users OK') cursor.execute(""" CREATE TABLE IF NOT EXISTS posts( id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, title TEXT, content TEXT, time TEXT, category TEXT, author TEXT, status TEXT ) """) conn.commit() conn.close() print ('table posts OK') return True def init_dir(): if os.path.isdir('users'): return False else: os.makedirs('./users/')