Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/forgot password #84

Open
wants to merge 208 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
4603336
Added README.md
CharlesKasasira Jul 19, 2023
4dc47d6
Added README.md (#2)
CharlesKasasira Jul 19, 2023
058c874
Added my name to README file (#3)
nantaletracy Jul 19, 2023
f78d03d
added my name to the readme file (#4)
judithkwesi Jul 19, 2023
e9c75d2
pull from upstream
CharlesKasasira Jul 19, 2023
9bf308f
updates
tugume123 Jul 20, 2023
29bfe70
add .gitignore
CharlesKasasira Jul 25, 2023
eb64df8
Charles (#5)
CharlesKasasira Jul 25, 2023
e0cdd12
new changes
CharlesKasasira Jul 25, 2023
2420fe6
fix conflicts
CharlesKasasira Jul 25, 2023
70c47d6
Charles (#6)
CharlesKasasira Jul 25, 2023
4d441c7
login css styling
CharlesKasasira Jul 25, 2023
1583b80
update urls
CharlesKasasira Jul 25, 2023
669f82c
forms.py
CharlesKasasira Jul 25, 2023
2e39ab7
forms.py
CharlesKasasira Jul 25, 2023
ae2e634
forms
CharlesKasasira Jul 25, 2023
58d8e8e
forms
CharlesKasasira Jul 25, 2023
58df0c5
update navbar
CharlesKasasira Jul 25, 2023
72b0e03
style: menu item
CharlesKasasira Jul 26, 2023
924b691
style: menu item
CharlesKasasira Jul 26, 2023
31c8290
style: hightlight selected menu
CharlesKasasira Jul 26, 2023
1d7f0af
chore: content structure
CharlesKasasira Jul 26, 2023
5b4e93c
chore: content structure
CharlesKasasira Jul 26, 2023
cc23926
add: monitor select box
CharlesKasasira Jul 26, 2023
9c5c833
refactor: html structure
CharlesKasasira Jul 26, 2023
ee98ef8
refactor: html structure
CharlesKasasira Jul 26, 2023
476743c
refactor: html structure
CharlesKasasira Jul 26, 2023
4f7beaf
refactor: html structure
CharlesKasasira Jul 26, 2023
2a96c0e
Charles (#7)
CharlesKasasira Jul 26, 2023
6870bc0
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 26, 2023
ddb32d3
gitignore: add .DS_Store files
CharlesKasasira Jul 26, 2023
3ba91d9
ignore .DS_Store (#8)
CharlesKasasira Jul 26, 2023
c74e428
change session age to 3600
CharlesKasasira Jul 26, 2023
bd9279c
Changed session age to 3600 (#9)
CharlesKasasira Jul 26, 2023
af6db21
add: renu favicon
CharlesKasasira Jul 26, 2023
588b565
Added favicon (#10)
CharlesKasasira Jul 26, 2023
846e8df
delete .DS_Store
CharlesKasasira Jul 26, 2023
807f301
deleted sqlitte
CharlesKasasira Jul 26, 2023
d6747d0
restart
CharlesKasasira Jul 26, 2023
ec497d2
Deleted db.sqlite (#12)
CharlesKasasira Jul 26, 2023
5e06532
chore: remove unsed packages
CharlesKasasira Jul 26, 2023
c029435
feat: download site files
CharlesKasasira Jul 26, 2023
dfab533
Debug: false
CharlesKasasira Jul 26, 2023
6fb3fd8
Charles (#13)
CharlesKasasira Jul 26, 2023
39ad543
add scheduler package
CharlesKasasira Jul 26, 2023
d7fbe73
change to hours for sites download
CharlesKasasira Jul 26, 2023
aa1e337
Sites Download interval 12hours (#14)
CharlesKasasira Jul 26, 2023
8d181fb
Tracycy (#15)
nantaletracy Jul 27, 2023
3fa17cb
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
6c86ee5
gitignore: Exception
CharlesKasasira Jul 27, 2023
7a44b70
gitignore: Exception (#16)
CharlesKasasira Jul 27, 2023
0d66adb
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
a8ed28d
Hide secret key
CharlesKasasira Jul 27, 2023
eeaef25
Generate & Hide secret_keys (#17)
CharlesKasasira Jul 27, 2023
5e6d56b
Tracycy (#18)
nantaletracy Jul 27, 2023
2617053
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
64a59cc
fix conflict
CharlesKasasira Jul 27, 2023
70ec7aa
set ALLOWED HOSTS
CharlesKasasira Jul 27, 2023
f74ff93
set ALLOWED HOSTS (#19)
CharlesKasasira Jul 27, 2023
20547d2
cleaned the code
Jul 27, 2023
54718ab
Github Actions
CharlesKasasira Jul 27, 2023
ce909d5
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
846c8c7
Github Actions (#20)
CharlesKasasira Jul 27, 2023
71623c8
update github actions
CharlesKasasira Jul 27, 2023
c692b3f
Tracycy (#21)
nantaletracy Jul 27, 2023
b17aac3
update actions
CharlesKasasira Jul 27, 2023
52373c1
Update Github Actions (#23)
CharlesKasasira Jul 27, 2023
889bd61
test
CharlesKasasira Jul 27, 2023
17ae4d9
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
e73aff3
test
CharlesKasasira Jul 27, 2023
7020303
changed check debug settngs
CharlesKasasira Jul 27, 2023
c746179
Test Actions
CharlesKasasira Jul 27, 2023
7aca8b6
changes
CharlesKasasira Jul 27, 2023
4822649
changes
CharlesKasasira Jul 27, 2023
09cd38a
changes
CharlesKasasira Jul 27, 2023
7f02c9e
Test Github Workflow (#24)
CharlesKasasira Jul 27, 2023
ddb3af7
changes
CharlesKasasira Jul 27, 2023
8dde2d5
changes
CharlesKasasira Jul 27, 2023
2d4497e
changes
CharlesKasasira Jul 27, 2023
f1866b9
Charles (#25)
CharlesKasasira Jul 27, 2023
20b7262
updated settings
CharlesKasasira Jul 27, 2023
84e3e93
updated settings
CharlesKasasira Jul 27, 2023
242068b
updated settings
CharlesKasasira Jul 27, 2023
93f464f
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
4a5a360
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
bcc5958
updated settings
CharlesKasasira Jul 27, 2023
62d16c8
Charles (#26)
CharlesKasasira Jul 27, 2023
c4cc38a
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
5b71ab2
check Debug in Settings
CharlesKasasira Jul 27, 2023
0414a51
check Debug in Settings
CharlesKasasira Jul 27, 2023
5613c1e
Charles (#27)
CharlesKasasira Jul 27, 2023
6fb1cc6
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
419df81
Actions environment variables
CharlesKasasira Jul 27, 2023
10f913d
Actions environment variables
CharlesKasasira Jul 27, 2023
0023916
Testing Actions when debug is left true (#28)
CharlesKasasira Jul 27, 2023
9af686d
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
5d767a4
Actions environment variables
CharlesKasasira Jul 27, 2023
60b4757
Charles (#29)
CharlesKasasira Jul 27, 2023
497b840
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
148f494
Actions environment variables
CharlesKasasira Jul 27, 2023
caabbfa
Actions environment variables
CharlesKasasira Jul 27, 2023
7276404
Testing Actions when debug is left true (#30)
CharlesKasasira Jul 27, 2023
f102cb0
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
aae4bad
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
8fe5de0
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
37dfe07
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
19834a9
Testing Actions when debug is left true (#31)
CharlesKasasira Jul 27, 2023
36925bf
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
76911bf
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
21b1784
Testing Actions when debug is left true (#32)
CharlesKasasira Jul 27, 2023
d11b88f
Testing Actions when debug is left true
CharlesKasasira Jul 27, 2023
9282da3
Testing Protected branch
CharlesKasasira Jul 27, 2023
b3e606f
update (#22)
tugume123 Jul 27, 2023
aa86841
Merge branch 'main' of https://github.com/judithkwesi/ip-monitoring-t…
CharlesKasasira Jul 27, 2023
0e9edc6
David (#34)
SsenabuyaDavid Jul 27, 2023
2003869
users
CharlesKasasira Jul 27, 2023
5eaf6e7
Users list
CharlesKasasira Jul 27, 2023
139e7a0
fix conflicts
CharlesKasasira Jul 27, 2023
c65ded7
Users pages (#35)
CharlesKasasira Jul 27, 2023
2419c5e
fix conflict
CharlesKasasira Jul 27, 2023
6886f5a
Charles (#36)
CharlesKasasira Jul 27, 2023
f688042
check for renu ips
CharlesKasasira Jul 27, 2023
4d917a4
Charles (#37)
CharlesKasasira Jul 27, 2023
cb1b8c5
feature rate limiting
CharlesKasasira Jul 27, 2023
e220b7a
add __pycache__ to .gitignore
CharlesKasasira Jul 27, 2023
f13611e
remove messages
CharlesKasasira Jul 27, 2023
714dac2
Refactor: Code modification
CharlesKasasira Jul 27, 2023
986eb7e
update .gitignore: removed pycache from vc
CharlesKasasira Jul 27, 2023
1f5683c
update .gitignore: removed myapp/__pycache from vc
CharlesKasasira Jul 27, 2023
cb57a91
update .gitignore: removed myapp/__pycache from vc
CharlesKasasira Jul 27, 2023
526ad90
fix merge conflicts
CharlesKasasira Jul 27, 2023
04d76d9
Charles (#38)
CharlesKasasira Jul 27, 2023
bde606f
Renamed project from myapp to ip-monitoring-tool
CharlesKasasira Jul 28, 2023
afba383
move the logout to the navbar
CharlesKasasira Jul 28, 2023
47e065f
fix conflicts
CharlesKasasira Jul 28, 2023
d59e6dd
updating branch
Jul 28, 2023
5eb7630
merge conflict
Jul 28, 2023
c492344
Features: Implemented User Authentication, Dashboard, script to parse…
Jul 28, 2023
5586a08
sites
CharlesKasasira Jul 28, 2023
8e0484b
display ips on dashboard
CharlesKasasira Jul 31, 2023
8e20efb
removed spamhaus: file too large
CharlesKasasira Jul 31, 2023
f03a03f
removed spamhaus: file too large
CharlesKasasira Jul 31, 2023
4caacef
fix merge conflicts
CharlesKasasira Jul 31, 2023
f1c5b00
fix conflict n cins
CharlesKasasira Jul 31, 2023
a99853b
remove logs
CharlesKasasira Jul 31, 2023
68ae6d0
docs: Adding contributing guidelines
CharlesKasasira Jul 31, 2023
6e2c5f3
Python program that checks whether the first fixed 32 bits of a given…
SsenabuyaDavid Aug 1, 2023
3a98124
Added functionality to the code to enable it check whether the prefix…
SsenabuyaDavid Aug 1, 2023
aeff8c3
Program checks whether input by the user is a subnet of the IPv6 addr…
SsenabuyaDavid Aug 1, 2023
d4fe58e
Program that can accept a text file and then identifies whether the i…
SsenabuyaDavid Aug 2, 2023
97a5b58
Feature/i pv6 (#44)
SsenabuyaDavid Aug 2, 2023
41b769a
Testing ci cd (#45)
judithkwesi Aug 2, 2023
feb487e
Python program that include a function that can be called to print ou…
SsenabuyaDavid Aug 2, 2023
dc8b5c1
Python program that include a function that can be called to print ou…
SsenabuyaDavid Aug 2, 2023
7fd060d
Python program that include a function that can be called to print ou…
SsenabuyaDavid Aug 2, 2023
54c7c39
Feature/IPv6 (#47)
SsenabuyaDavid Aug 2, 2023
8b38603
Feature/user management (#48)
CharlesKasasira Aug 3, 2023
9065bf7
Testing: Remove migrations from test coverage (#49)
CharlesKasasira Aug 3, 2023
8b47436
Merge branch 'staging' of https://github.com/judithkwesi/ip-monitorin…
SsenabuyaDavid Aug 3, 2023
8731d36
Modification of IPv6 program
SsenabuyaDavid Aug 3, 2023
5aebc4e
Modification of IPv6 program
SsenabuyaDavid Aug 3, 2023
d289ff1
Feature/ipv6 (#50)
SsenabuyaDavid Aug 3, 2023
40a3ed8
IPv6 address that identifies whether IPv4 addresses are listed in spa…
SsenabuyaDavid Aug 3, 2023
e95d502
IPv6 address that identifies whether IPv4 addresses are listed in spa…
SsenabuyaDavid Aug 3, 2023
ea109c1
Feature/ipv4 spamhaus (#52)
SsenabuyaDavid Aug 3, 2023
ca1f147
IPv6 address that identifies whether IPv4 addresses are listed in spa…
SsenabuyaDavid Aug 3, 2023
38f8706
Merge branch 'staging' into feature/IPv4_spamhaus
SsenabuyaDavid Aug 3, 2023
2718512
Feature/i pv4 spamhaus (#53)
SsenabuyaDavid Aug 3, 2023
8c7d4d3
Access Levels: Hidden users and settings page from non-admins (#54)
CharlesKasasira Aug 3, 2023
6e27c7d
Remove duplicate code (#55)
CharlesKasasira Aug 4, 2023
412647c
Fix: Default sync interval for downloading from the sites (#56)
CharlesKasasira Aug 4, 2023
2e452c9
Merge branch 'development' into staging
CharlesKasasira Aug 4, 2023
d9769c8
Merge conflicts
SsenabuyaDavid Aug 4, 2023
6dd17a9
Added deployment Script (#59)
CharlesKasasira Aug 4, 2023
6df40b4
Response design: visible on the mobile phone (#60)
CharlesKasasira Aug 5, 2023
79199a7
Update Deploy script (#61)
CharlesKasasira Aug 5, 2023
fae4a1d
Adde user ip and device info in logs (#62)
CharlesKasasira Aug 7, 2023
1a493f1
Enabling of the forgot password functionality in the program
SsenabuyaDavid Aug 7, 2023
f6d5434
Executed test deployment script on Pull Request (#63)
CharlesKasasira Aug 7, 2023
db0a53a
Chore/ci cd (#64)
CharlesKasasira Aug 7, 2023
584e307
Chore/ci cd (#65)
CharlesKasasira Aug 7, 2023
4c93956
Continuous Deployment: build on pushing to the staging branch (#66)
CharlesKasasira Aug 7, 2023
7641f1b
Chore/ci cd: Deployment script (#67)
CharlesKasasira Aug 7, 2023
e546b71
Chore/ci cd (#68)
CharlesKasasira Aug 7, 2023
da57c6f
Chore/ci cd (#69)
CharlesKasasira Aug 7, 2023
5e51958
Test 34: Automatic deployment on test environment (#70)
CharlesKasasira Aug 7, 2023
1cb7f1e
Test 35: Automatic deployment on test environment (#71)
CharlesKasasira Aug 7, 2023
8b32677
Chore/ci cd (#72)
CharlesKasasira Aug 7, 2023
d052749
Chore/ci cd (#73)
CharlesKasasira Aug 7, 2023
e780623
Test 38(Execute with sudo): Automatic deployment on test environment …
CharlesKasasira Aug 7, 2023
662636c
Test 39(Disown background process): Automatic deployment on test envi…
CharlesKasasira Aug 7, 2023
dbecd19
Test 40 (Disown background process): Automatic deployment on test env…
CharlesKasasira Aug 7, 2023
e90d7cc
Chore/ci cd (#77)
CharlesKasasira Aug 7, 2023
f601833
change log message (#78)
CharlesKasasira Aug 7, 2023
c2237eb
Chore/ci cd (#79)
CharlesKasasira Aug 7, 2023
5945f3b
Use of SMTP for sending emails
SsenabuyaDavid Aug 8, 2023
3639bc8
Use of SMTP for sending emails
SsenabuyaDavid Aug 8, 2023
46d1a5f
Rectification of variable names on in the source code
SsenabuyaDavid Aug 8, 2023
ce0215b
Rectification of conflicts
SsenabuyaDavid Aug 8, 2023
7140c15
Feature/ipv4 spamhaus (#80)
SsenabuyaDavid Aug 8, 2023
5877bfe
Feature/ipv4 spamhaus (#81)
SsenabuyaDavid Aug 9, 2023
0fc8ee3
Feature/spamhaus data: fetch data from spamhaus (#82)
CharlesKasasira Aug 9, 2023
7987d58
Feature/spamhaus data: Resolved Merge conflicts (#83)
CharlesKasasira Aug 10, 2023
28523e6
Enactment of forgot password feature on the program
SsenabuyaDavid Aug 10, 2023
97b436c
Feature/forgot password (#85)
SsenabuyaDavid Aug 10, 2023
c23ddfe
Feature/spamhaus data (#86)
CharlesKasasira Aug 10, 2023
8269644
Enablement of the forgot password feature on the program
SsenabuyaDavid Aug 10, 2023
c5abb0b
Merge branch 'staging' into feature/forgot_password
SsenabuyaDavid Aug 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash

# Constants
REPO_URL="https://github.com/judithkwesi/ip-monitoring-tool.git"
PROJECT_DIR="/home/charles/ip-reputation/staging/ip-monitoring-tool"
VENV_DIR="/home/charles/ip-reputation/staging/dev_env"
# SYSTEMD_SERVICE="your_service_name.service"

# Function to update the code from GitHub
update_code() {
echo "Updating code from GitHub..."
git pull origin staging
}

# Function to install Python dependencies
install_dependencies() {
echo "Installing Python dependencies..."
cd "$PROJECT_DIR"
echo "Activating Virtual Environment..."
source $VENV_DIR/bin/activate
pip install -r requirements.txt
}

# Function to run database migrations
run_migrations() {
echo "Running database migrations..."
cd "$PROJECT_DIR"
source $VENV_DIR/bin/activate
echo "Activating Virtual Environment..."
python manage.py migrate
}

run_collectstatic() {
echo "Running static files..."
cd "$PROJECT_DIR"
source $VENV_DIR/bin/activate
echo "Activating Virtual Environment..."
chmod +w "$PROJECT_DIR"/static


python manage.py collectstatic --noinput
}

# Function to restart the server
# restart_server() {
# echo "Restarting the server..."
# sudo systemctl restart $SYSTEMD_SERVICE
# }

# Function to stop the program running on port 8001
stop_program_on_port() {
echo "Stopping program on port 8001..."
local pids=$(sudo lsof -t -i :8001)

if [ -z "$pids" ]; then
echo "No program found running on port 8001."
else
for pid in $pids; do
sudo kill -9 "$pid"
echo "Terminated process with PID: $pid"
done
echo "Program(s) stopped successfully."
fi

# restart gunicorn
# gunicorn ip-monitoring-tool.wsgi:application --bind 127.0.0.1:8001 &
nohup gunicorn ip-monitoring-tool.wsgi:application --bind 127.0.0.1:8001 >/dev/null 2>&1 &
disown

echo "Gunicorn restarted on port 8001."
}

# Main deployment process
main() {
update_code
# install_dependencies
run_migrations
# restart_server
run_collectstatic
stop_program_on_port
echo "Deployment successful!"
}

main
5 changes: 5 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!bin/bash

echo "From the bottom, now we are here 1"
echo "From the bottom, now we are here 2"
echo "From the bottom, now we are here 3"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ secret_key.txt
ip-monitoring-tool/__pycache__/
**/migrations/

.coverage
htmlcov/

mainapp/tests

#Except
!mainapp/static
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# CONTRIBUTING GUIDELINES

### Branch Naming

To have a consitent and well-defined branch naming convention for effective collaboration and verson control management, please following the following guidelines

#### 1. Branch Prefixes:

Consider using specific prefixes to indicate the purpose of the branch. For example:

- `feature/` for new feature development
- `bugfix/` for bug fixes
- `hotfix/` for critical bug fixes
- `release/` for release preparation
- `docs/` for documentation updates
- `chore/` for maintenance or other non-feature tasks

For example, if you are working on a new feature for addind users, you might create a branch with the name `feature/add-user`. If it's a bugfix, you might use `bugfix/fix-validation-bug`.

#### 2. Use Hyphens

Use hyphens to separate words in the branch name for better readability. For example, `feature/add-user` or `bugfix/fix-validation-bug`.

#### 3. Short and Meaningful

Keep branch names concise but meaningful. Avoid excessively long names that may become cumbersome.

#### 4. Lowercase Letters

Use lowercase letters for branch names to maintain consistency and avoid potential issues with case sensitivity on different operating systems.

#### 5. Avoid Special Characters

Avoid using special characters or spaces in branch names to ensure compatibility across various version control systems.

#### 6. Use Descriptive Names

Choose branch names that clearly describe the purpose or the feature being worked on. Avoid generic names like "branch1" or "fix_bug".

### Use Meaningful commit messages

#### 1. Be Descriptive

Start the commit message with a concise description of what the commit accomplishes. Use the imperative mood (`Add`, `Fix`, `Update`, `Refactor`, `Revert`, `test`, `chore`) to indicate the action performed.

#### 2. Reference Issues

If the commit relates to an issue or task, include a reference to it using issue numbers (e.g., "Fixes #123," "Closes #456,").

#### 3. Be Consistent:

Use the same commit style throughout to keep consistency
forexample
```shell
docs: correct spelling of CHANGELOG
```

Reference

[Converntional Commites](https://www.conventionalcommits.org/en/v1.0.0/)
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
The IP Reputation Monitoring Application is a web-based tool that enables the organization to assess the reputation of IP addresses and blocks in real-time.

# Features

- [x] Authentication
- [x] User Interface Design
- [x] Dashboard
- [x] User management
- [] Responsive Design
- [] Settings
- [] Download Sites files
- [] Checking for ips in the sites
- [] Documents


- [ ] Responsive Design
- [ ] Settings
- [ ] Download Sites files
- [ ] Checking for ips in the sites
- [ ] Documents

#### Team 1

David Ssenabulya

Charles Kasasira

Nantale Tracy Cynthia

Kizza Judith Kwesiga
| # | Names |
| --- | --------------------- |
| 1 | David Ssenabulya |
| 2 | Charles Kasasira |
| 3 | Nantale Tracy Cynthia |
| 4 | Kizza Judith Kwesiga |
| 5 | Tugume Jullian Praise |

Tugume Jullian Praise
*For the Developers,
Follow the [CONTRIBUTING](./CONTRIBUTING.md) guidelines
90 changes: 68 additions & 22 deletions ip-monitoring-tool/settings.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
from pathlib import Path
import os
import sys

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# SECURITY WARNING: keep the secret key used in production secret!
# with open(os.path.join(BASE_DIR, 'secret_key.txt')) as f:
# SECRET_KEY = f.read().strip()
BASE_DIR = Path(__file__).resolve().parent.parent

if os.environ.get("GITHUB_ACTIONS") == "true":
# Running in GitHub Actions, get the secret key from the environment variable
SECRET_KEY = '459a2211e3e1cb2219fde2460560070c7081872b629211708'
else:
# Not running in GitHub Actions, read the secret key from the file
with open(os.path.join(BASE_DIR, 'secret_key.txt')) as f:
SECRET_KEY = f.read().strip()

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True

ALLOWED_HOSTS = ['137.63.148.213', '127.0.0.1']
ALLOWED_HOSTS = ['137.63.148.213', '127.0.0.1', 'crappie-first-koala.ngrok-free.app']

if 'test' in sys.argv or 'test_coverage' in sys.argv:
COVERAGE_MODULE_EXCLUDES = ['tests', 'mainapp/migrations', 'migrations', 'settings']
COVERAGE_REPORT_HTML_OUTPUT_DIR = 'coverage_html'

# Application definition

INSTALLED_APPS = [
'mainapp', # First priority application: We shall use this application's
#templates instead of the inbuilt templates
'django.contrib.admin', #This app is to be used for authentication
'mainapp',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand All @@ -49,7 +46,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand All @@ -66,7 +63,6 @@


# Database

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
Expand All @@ -92,35 +88,85 @@
]


# Internationalization
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%d/%b/%Y %H:%M:%S',
},
},
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': './ip-monitoring-logs.log',
'formatter': 'verbose',
},
},
'loggers': {
'ip-monitoring-tool': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

# Internationalization
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = 'static/'
STATIC_ROOT = 'static/'


# Default primary key field type

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

LOGIN_REDIRECT_URL = 'dashboard'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'

# Session
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 3600 # 1 hour

# Secure flag for the session cookie (set it to True for HTTPS-only)
SESSION_COOKIE_SECURE = False


# CSRF_TRUSTED_ORIGINS = ['https://crappie-first-koala.ngrok-free.app', 'http://137.63.148.213:8888']
CSRF_TRUSTED_ORIGINS = ['http://137.63.148.213:8888']




# settings.py

# Set the email backend for sending emails through SMTP
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Set the email backend for sending emails through console
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# SMTP settings
# EMAIL_HOST = 'smtp.gmail.com' # Replace with your SMTP server address
# EMAIL_PORT = 587 # Replace with your SMTP server port (587 for TLS, 465 for SSL)
# EMAIL_USE_TLS = True # Use TLS (True) or SSL (False) depending on your server configuration
# EMAIL_USE_SSL = False
# EMAIL_HOST_USER = 'daveseynabou@gmail.com' # Replace with your email address
# EMAIL_HOST_PASSWORD = 'your_email_password' # Replace with your email password or API key
# DEFAULT_FROM_EMAIL = 'admin@renu.ac.ug' # Replace with the email address to appear as the sender

CSRF_TRUSTED_ORIGINS = ['https://crappie-first-koala.ngrok-free.app', 'http://137.63.148.213:8888']
# CSRF_TRUSTED_ORIGINS = ['http://137.63.148.213:8888']

4 changes: 2 additions & 2 deletions mainapp/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ class MainappConfig(AppConfig):
name = 'mainapp'

def ready(self):
from .scheduler import updater
updater()
from .scheduler import schedule_site_downloads
schedule_site_downloads()
Loading