Compare commits

...

2 Commits

Author SHA1 Message Date
bobbyvish
b7dc64b4cc fix(email): change mail to domain associated 2024-07-11 13:34:59 +05:30
bobbyvish
3497d2f4a9 Added readme file 2024-06-12 12:26:17 +05:30
5 changed files with 84 additions and 6 deletions

77
README.md Normal file
View File

@@ -0,0 +1,77 @@
# Installation Guide for Digest Backend
Follow these steps to set up the Digest Backend project on your local machine.
## Cloning the Repository
1. Clone the repository:
```sh
$ git clone https://github.com/WDI-Ideas/digest_backend.git
$ cd digest_backend
```
## Setting Up the Environment
2. Install `virtualenv` if you haven't already:
```sh
$ pip install virtualenv
```
3. Create a virtual environment:
```sh
$ virtualenv venv
```
4. Activate the virtual environment:
**Windows:**
```sh
venv\Scripts\activate
```
**Mac/Linux:**
```sh
source venv/bin/activate
```
## Installing Dependencies
5. Install the required dependencies using pip:
```sh
$ pip install -r requirements.txt
```
## Configuring the Environment Variables
6. Copy and rename the env.example file to .env and set all the required variables. Ensure there are no spaces around the =:
```sh
$ cp env.example .env
```
## Migrating the Database
7. Run the following command to create the database tables:
```sh
$ python manage.py migrate
```
## Pre-Populating the Database
8. Run the following command to pre-populate the database with custom command:
```sh
$ python manage.py load_iam_fixture
```
## Running the Server
9. Run the following command to start the server:
```sh
$ python manage.py runserver
```
Now, your server should be up and running. Access it in your browser at http://127.0.0.1:8000/.
## Note :
- Make sure you have Python and pip installed on your system.
- If you encounter any issues, ensure that all dependencies are properly installed and the environment variables are correctly configured.
- Always activate the virtual environment before running any Python or Django commands.

View File

@@ -139,7 +139,7 @@ class OtpRequestView(APIView):
return ApiResponse.error(
message=constants.EMAIL_REQUIRED, errors=constants.EMAIL_REQUIRED
)
print(f"email auth username: {settings.EMAIL_HOST_USER}")
print(f"email auth username: {settings.DEFAULT_FROM_EMAIL}")
email = request.data.get("email")
principal = get_principal_by_email(email=email)
@@ -161,7 +161,7 @@ class OtpRequestView(APIView):
email_service = EmailService(
subject="Password Reset Request",
to=principal.email,
from_email=settings.EMAIL_HOST_USER,
from_email=settings.DEFAULT_FROM_EMAIL,
)
# Send the email

View File

@@ -216,6 +216,7 @@ EMAIL_HOST_USER = env.str("EMAIL_HOST_USER")
EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD")
EMAIL_PORT = env.str("EMAIL_PORT")
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = env.str("DEFAULT_FROM_EMAIL")
ONESIGNAL_APP_ID = env.str("ONESIGNAL_APP_ID")
ONESIGNAL_REST_API_KEY = env.str("ONESIGNAL_REST_API_KEY")

View File

@@ -115,7 +115,7 @@ class ContactUsReplyView(LoginRequiredMixin, generic.View):
email_service = EmailService(
subject=f"Reply of your inquiry - {instance.subject}",
to=instance.email_address,
from_email=settings.EMAIL_HOST_USER,
from_email=settings.DEFAULT_FROM_EMAIL,
)
email_service.set_text_body(message)
email_service.send()
@@ -162,7 +162,7 @@ def ContactUsLandingView(request):
support_team_service = EmailService(
subject=f"New contact us - {subject}",
to=email,
from_email=settings.EMAIL_HOST_USER,
from_email=settings.DEFAULT_FROM_EMAIL,
)
support_team_service.load_template(
@@ -174,7 +174,7 @@ def ContactUsLandingView(request):
thankyou_service = EmailService(
subject=f"New contact us - {subject}",
to=email,
from_email=settings.EMAIL_HOST_USER,
from_email=settings.DEFAULT_FROM_EMAIL,
)
thankyou_service.load_template(

View File

@@ -25,7 +25,7 @@
<p>Hello {{name}},</p>
<p>It looks like you've requested a password reset for your account.</p>
<p>To reset your password, please use the following secret code:</p>
<p><strong>{{ code }}</strong></p>
<h2><strong>{{ code }}</strong></h2>
<p>If you didn't request a password reset, you can safely ignore this email.</p>
<p>Thank you,</p>
<p>Team Digest</p>