First commit
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
# LOGIS PERSONNEL — Application immobilière
|
||||
|
||||
Site vitrine bilingue (français / anglais) de gestion et présentation de biens immobiliers, construit avec Django 4.2.
|
||||
|
||||
**URL de production** : https://logis.miraceti.net
|
||||
**Admin** : https://logis.miraceti.net/admin/
|
||||
|
||||
---
|
||||
|
||||
## Stack technique
|
||||
|
||||
| Composant | Technologie |
|
||||
|---|---|
|
||||
| Backend | Django 4.2, Python 3.13 |
|
||||
| Serveur | Gunicorn 3 workers, port 8091 |
|
||||
| Proxy | nginx (SSL certbot, rate-limit) |
|
||||
| Process | Supervisor |
|
||||
| Images | django-resized → WEBP automatique |
|
||||
| Tri drag-and-drop | django-admin-sortable2 |
|
||||
| Fichiers statiques | Whitenoise |
|
||||
| Config | python-decouple (.env) |
|
||||
| Base de données | SQLite |
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
unset REQUESTS_CA_BUNDLE SSL_CERT_FILE CURL_CA_BUNDLE # VPS spécifique
|
||||
pip install -r requirements.txt
|
||||
cp .env.example .env # puis éditer .env
|
||||
./manage.py migrate
|
||||
./manage.py createsuperuser
|
||||
./manage.py collectstatic
|
||||
```
|
||||
|
||||
### Développement
|
||||
|
||||
```bash
|
||||
./manage.py runserver
|
||||
```
|
||||
|
||||
Le fichier `manage.py` utilise `logis_project.settings.development` par défaut.
|
||||
|
||||
### Production
|
||||
|
||||
```bash
|
||||
# Copier les configs
|
||||
sudo cp conf/nginx.conf /etc/nginx/sites-available/logis
|
||||
sudo ln -sf /etc/nginx/sites-available/logis /etc/nginx/sites-enabled/logis
|
||||
sudo cp conf/supervisor.conf /etc/supervisor/conf.d/logis.conf
|
||||
|
||||
# Créer les répertoires de logs
|
||||
sudo mkdir -p /var/log/logis
|
||||
sudo chown miraceti:miraceti /var/log/logis
|
||||
|
||||
# Permissions home (nginx doit traverser le répertoire)
|
||||
chmod 711 /home/miraceti
|
||||
|
||||
# SSL
|
||||
sudo certbot certonly --webroot -w /var/www/html -d logis.miraceti.net
|
||||
|
||||
# Démarrer
|
||||
sudo systemctl reload nginx
|
||||
sudo supervisorctl reread && sudo supervisorctl update
|
||||
sudo supervisorctl start logis
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Commandes courantes
|
||||
|
||||
```bash
|
||||
# Redémarrer l'application après modification
|
||||
sudo supervisorctl restart logis
|
||||
|
||||
# Voir les logs
|
||||
tail -f /var/log/logis/gunicorn_error.log
|
||||
tail -f /var/log/logis/django.log
|
||||
|
||||
# Appliquer une migration
|
||||
DJANGO_SETTINGS_MODULE=logis_project.settings.production ./manage.py migrate
|
||||
|
||||
# Régénérer les statiques
|
||||
DJANGO_SETTINGS_MODULE=logis_project.settings.production ./manage.py collectstatic --no-input
|
||||
|
||||
# Traductions
|
||||
./manage.py makemessages -l en
|
||||
./manage.py compilemessages
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Variables d'environnement (.env)
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `SECRET_KEY` | Clé secrète Django |
|
||||
| `DEBUG` | `False` en production |
|
||||
| `ALLOWED_HOSTS` | Hosts autorisés, séparés par des virgules |
|
||||
| `EMAIL_HOST` | Serveur SMTP |
|
||||
| `EMAIL_PORT` | Port SMTP (587 pour STARTTLS) |
|
||||
| `EMAIL_HOST_USER` | Identifiant SMTP |
|
||||
| `EMAIL_HOST_PASSWORD` | Mot de passe SMTP |
|
||||
| `EMAIL_USE_TLS` | `True` pour STARTTLS |
|
||||
| `DEFAULT_FROM_EMAIL` | Adresse expéditeur |
|
||||
| `ADMIN_EMAIL` | Destinataire des formulaires de contact |
|
||||
|
||||
---
|
||||
|
||||
## Structure des répertoires
|
||||
|
||||
```
|
||||
LOGIS/
|
||||
├── conf/ # nginx, gunicorn, supervisor
|
||||
├── locale/ # Traductions fr/en (.po / .mo)
|
||||
├── logis_project/ # Settings, urls, wsgi
|
||||
│ └── settings/
|
||||
│ ├── base.py
|
||||
│ ├── development.py
|
||||
│ └── production.py
|
||||
├── properties/ # Application principale
|
||||
│ ├── models.py # Property, Room, Photo, ContactRequest…
|
||||
│ ├── admin.py # Interface d'administration
|
||||
│ ├── views.py # Liste, détail, contact (AJAX)
|
||||
│ ├── sitemaps.py # Sitemap XML
|
||||
│ └── templatetags/ # property_tags (filtres, lang_switch_url…)
|
||||
├── static/ # Sources CSS / JS / images
|
||||
├── staticfiles/ # Sortie collectstatic (servi par nginx)
|
||||
├── templates/ # Templates HTML + emails + robots.txt
|
||||
└── media/ # Uploads (photos des biens)
|
||||
```
|
||||
Reference in New Issue
Block a user