this is the code to set up up django, and I will post the error too that I encounter on the console…
import sqlite3
dataBase = sqlite3.connect(
host = ‘localhost’,
user = ‘Tata’,
passwd = ‘password123’,
#name = ‘BASE_DIR’ ‘db.sqlite3’,
)
prepare a cursor object
cursorObject = dataBase.cursor()
Replace ‘mydatabase.db’ with the actual path to your database file
database_path = ‘db.sqlite3’
try:
# Create a connection to the SQLite database
connection = sqlite3.connect(database_path)
# Create a cursor object to execute SQL commands
cursor = connection.cursor()
# Now you can execute SQL queries and work with the database using the 'cursor' object
# Don't forget to commit any changes and close the connection when done
connection.commit()
connection.close()
except sqlite3.Error as e:
print(“SQLite error:”, e)
create a database
cursorObject.execute(“CREATE DATABASE Mlawudb”)
#print(“All is Done:”) still have problems with DB connection
Here is the Console error:
Traceback (most recent call last):
File “c:\djangcrm\djangcrm\mydb.py”, line 3, in
dataBase = sqlite3.connect(
^^^^^^^^^^^^^^^^
TypeError: Connection() missing required argument ‘database’ (pos 1)
What did I do wrong?