I have an education website and a blog to it, the website is in php language, but the blog was written in django. i need to make the blog use the users information from the php .sql database, so the user should not need to register in the blog. I am using sqllite in the blog. here is the .sql file.
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`ID` int(11) NOT NULL,
`username` varchar(25) NOT NULL,
`fullname` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`birth` date NOT NULL,
`gender` varchar(22) NOT NULL,
`role` varchar(22) NOT NULL DEFAULT 'Student',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`ID`, `username`, `fullname`, `email`, `password`, `birth`, `gender`, `role`, `created_at`) VALUES
(1, 'ahmedsobh', 'Ahmed Sobh', '[email protected]', '123123', '1995-03-25', 'Male', 'Doc', '2017-06-19 14:41:45'),
(2, 'koko', 'Kareem Sobh', 'koko@ay', '1212', '1212-12-12', 'Male', 'Student', '2017-06-19 14:41:45');
--
-- Indexes for dumped tables
--
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
so how to edite the settings file to be able to read the table users in this .sql file so that any user in the table can just login in the blog without registration.
Here is the settings for the sqlite of the blog:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } }
Password validation
https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ]