The Mother of All Calendars. A web application to easily manage large team of services providers.
Enough with crowded shared calendars, we need a better way to manage our team's tasks and services. This is where Calendarinho comes in. With Calendarinho, you can easily have an eagle view of your team's calendars and tasks, and manage them all in one place.
- Backend: Django (Python 3.8+)
- Database: MySQL / SQLite
- Frontend: HTML, CSS, JavaScript
- Authentication: Django Auth + LDAP/Active Directory support
- Deployment: Docker & Docker Compose
- Web Server: Nginx (in production)
- Clone the repository:
git clone https://github.com/Cainor/Calendarinho.git
cd Calendarinho- Build and Start the Docker image:
docker-compose -f docker-compose.test.yml up -d --build- Wait for 1 min (Could take longer if it is the first time) for the database to be ready.
- Go to http://localhost:8000 and login with the credentials:
admin
admin
- Clone the repository:
git clone https://github.com/Cainor/Calendarinho.git
cd Calendarinho- Create a copy of the
.env.examplefile and rename it to.env.prod:
cp .env.example .env.prod- Edit the
.env.prodfile and set the environment variables with your settings. - Add your SSL certificate to ssl folder. Must be called "certificate.crt"
ssl/certificate.crt
- If you don't have a SSL certificate, you can generate one with the following command:
bash generate-cert.sh- Build and Start the Docker image:
docker-compose --env-file .env.prod -f docker-compose.prod.yml up -d --build- Wait for 1 min for the database to be ready.
- Go to http://localhost and login with the credentials you set in the
.env.prodfile.
- You must have Python 3 installed.
- Install the requirements libraries:
python -m pip install -r requirements.txt
- Go through the
Calendarinho/settings.pyand set your settings, specially the Database:
(In the Calendarinho/settings.py file)
# MySQL Database:
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'Calendarinho',
# 'USER': 'Calendarinhouser',
# 'PASSWORD': 'Calendarinhopassword',
# 'HOST': 'localhost',
# 'PORT': '',
# }
# }
# sqlite3 Database:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}Also, in the same file, you can setup the Email settings:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Gamil Settings (You must enable "Less-Secure-App" in Google account settings)
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# EMAIL_HOST = 'smtp.gmail.com'
# EMAIL_PORT = 587
# EMAIL_USE_TLS = True
# EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
# EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASSWORD')- Run: "makemigrations":
python manage.py makemigrations users
python manage.py makemigrations CalendarinhoApp
python manage.py makemigrations
- Run: "migrate":
python manage.py migrate users
python manage.py migrate CalendarinhoApp
python manage.py migrate
- Run: "collectstatic"
python manage.py collectstatic
- Create the admin user:
python manage.py createsuperuser
Calendarinho supports both local authentication and Active Directory (AD) authentication. Users can log in with either their local account credentials or their AD credentials seamlessly.
Edit your settings file (Calendarinho/settings/base.py for the current setup) and set:
ENABLE_AD_AUTHENTICATION = TrueAdd your Active Directory server configuration:
# LDAP/AD Server Configuration
AUTH_LDAP_SERVER_URI = "ldap://your-domain-controller.company.com"
AUTH_LDAP_BIND_DN = "cn=service-account,ou=Service Accounts,dc=company,dc=com"
AUTH_LDAP_BIND_PASSWORD = "your-service-account-password"
# User search configuration
AUTH_LDAP_USER_SEARCH = LDAPSearch(
"ou=Users,dc=company,dc=com",
ldap.SCOPE_SUBTREE,
"(sAMAccountName=%(user)s)" # Use (uid=%(user)s) for some LDAP servers
)
# Attribute mapping from AD to Django user model
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
}
# Always update user attributes on login
AUTH_LDAP_ALWAYS_UPDATE_USER = TrueYou can map AD groups to Django permissions:
# Group configuration (optional)
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
"ou=Groups,dc=company,dc=com",
ldap.SCOPE_SUBTREE,
"(objectClass=group)"
)
AUTH_LDAP_GROUP_TYPE = ActiveDirectoryGroupType()
# User flags mapping based on AD group membership
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": "cn=Active Users,ou=Groups,dc=company,dc=com",
"is_staff": "cn=Staff,ou=Groups,dc=company,dc=com",
"is_superuser": "cn=Admins,ou=Groups,dc=company,dc=com"
}
# Cache group memberships for better performance
AUTH_LDAP_CACHE_TIMEOUT = 3600Run the built-in configuration test:
python manage.py test_ad_setupTest authentication with an actual AD user:
python manage.py test_ad_setup --test-ad-user --username your-ad-usernameUse the helper command to generate configuration:
python manage.py configure_ad --help