Projekte: Unterschied zwischen den Versionen

Aus AstroNeth-Wiki
Zur Navigation springen Zur Suche springen
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== Homepage ==


# Projekt Homepage astroneth.eu
== Projekt Homepage astroneth.eu ==


## Python Environment-Installation im entsprechenden Verzeichnis
=== Python Environment-Installation im entsprechenden Verzeichnis ===


1. python3 -m venv .venv
*python3 -m venv .venv
1. .venv\Scripts\activate.ps1
*.venv\Scripts\activate.ps1


  oder
    oder
  source .venv/bin/activate
    source .venv/bin/activate
  jetzt kann python.exe mit python benutzt werden
    jetzt kann python.exe mit python benutzt werden
  deactivate ==> das Enviroment wieder deaktivieren
    deactivate ==> das Enviroment wieder deaktivieren
1. pip install django mysqlclient
 
*pip install django mysqlclient


       pip install --upgrade django
       pip install --upgrade django
1. pip list
      pip install --upgrade pip
1. python -m django --version
 
*pip list
*python -m django --version


       ℹ nur zur Prüfung ob alles OK ist
       ℹ nur zur Prüfung ob alles OK ist
1. python -m pip install -U Django


      ℹ Django upgraden 
*python -m pip install -U Django


## Projekt anlegen
      ℹ Django upgraden
*pipenv install django-debug-toolbar


1. django-admin startproject astroneth
=== Projekt anlegen ===
1. python manage.py startapp home
 
1. urls.py erstellen und registrieren (include in Projekt urls.py)
*django-admin startproject astroneth
1. settings.py bearbeiten
*python manage.py startapp home
*urls.py erstellen und registrieren (include in Projekt urls.py)
*settings.py bearbeiten


       DATABASES = {
       DATABASES = {
Zeile 37: Zeile 41:
           'PASSWORD': 'xxxxxxxxx',
           'PASSWORD': 'xxxxxxxxx',
           'HOST': 'localhost',
           'HOST': 'localhost',
           'PORT': '',
           'PORT': '',''
           }
           }
       }
       }
Zeile 52: Zeile 56:
            
            
       LANGUAGE_CODE = 'de'
       LANGUAGE_CODE = 'de'
 
     
       TIME_ZONE = 'Europe/Berlin'
       TIME_ZONE = 'Europe/Berlin'
        
        
Zeile 61: Zeile 65:
       STATIC_ROOT = os.path.join(BASE_DIR, "static") *** wieder raus nach collectstatic
       STATIC_ROOT = os.path.join(BASE_DIR, "static") *** wieder raus nach collectstatic
   
   
1. Ordnerstruktur erweitern (templates und static)  
* Ordnerstruktur erweitern (templates und static)  
1. python manage.py collectstatic (kopiert die Adminfiles aus den Django-Verzeichnis in static)               
* python manage.py collectstatic (kopiert die Adminfiles aus den Django-Verzeichnis in static)               
1. Models erstellen
* Models erstellen
1. python manage.py makemigrations
* python manage.py makemigrations
1. python manage.py migrate
* python manage.py migrate
1. python manage.py createsuperuser
* python manage.py createsuperuser
1. python manage.py runserver
* python manage.py runserver


## Hompage Deployment
=== Hompage Deployment ===
* git pull git@github.com:holnet/Homepage.git
* git pull git@github.com:holnet/Homepage.git
* sudo systemctl restart apache2
* sudo systemctl restart apache2

Aktuelle Version vom 2. Oktober 2023, 22:25 Uhr

Projekt Homepage astroneth.eu

Python Environment-Installation im entsprechenden Verzeichnis

  • python3 -m venv .venv
  • .venv\Scripts\activate.ps1
   oder
   source .venv/bin/activate
   jetzt kann python.exe mit python benutzt werden
   deactivate ==> das Enviroment wieder deaktivieren
  • pip install django mysqlclient
      pip install --upgrade django
      pip install --upgrade pip
  • pip list
  • python -m django --version
      ℹ nur zur Prüfung ob alles OK ist
  • python -m pip install -U Django
      ℹ Django upgraden
  • pipenv install django-debug-toolbar

Projekt anlegen

  • django-admin startproject astroneth
  • python manage.py startapp home
  • urls.py erstellen und registrieren (include in Projekt urls.py)
  • settings.py bearbeiten
      DATABASES = {
          'default': {
          'ENGINE': 'django.db.backends.mysql',
          'NAME': 'db-name',
          'USER': 'db-user',
          'PASSWORD': 'xxxxxxxxx',
          'HOST': 'localhost',
          'PORT': ,
          }
      }
      	
      INSTALLED_APPS = [
          'home',
          ...   
      
      TEMPLATES = [
          {
          ...
          'DIRS': [(BASE_DIR / 'templates')],        	
          ...
          
      LANGUAGE_CODE = 'de'
      
      TIME_ZONE = 'Europe/Berlin'
      
      STATIC_URL = 'static/'
      #STATICFILES_DIRS = [
      #    BASE_DIR / "static"
      #]  
      STATIC_ROOT = os.path.join(BASE_DIR, "static") *** wieder raus nach collectstatic

  • Ordnerstruktur erweitern (templates und static)
  • python manage.py collectstatic (kopiert die Adminfiles aus den Django-Verzeichnis in static)
  • Models erstellen
  • python manage.py makemigrations
  • python manage.py migrate
  • python manage.py createsuperuser
  • python manage.py runserver

Hompage Deployment

  • git pull git@github.com:holnet/Homepage.git
  • sudo systemctl restart apache2

zurück zur ==> Hauptseite