Anki

Aus Dokument
Version vom 25. Oktober 2024, 21:33 Uhr von Thorsten (Diskussion | Beiträge) (// via Wikitext Extension for VSCode)
Zur Navigation springen Zur Suche springen

Hinweis: Diese Inhalte wurden mit Unterstützung von Künstlicher Intelligenz erstellt und redaktionell überprüft (Transparenzhinweis gemäß Art. 50 EU AI Act).

Anki

Installation und Starten

Django

Grundaufbau einer Django Anwendung und Installieren von Django

python -m venv .venv
source .venv/bin/activate
pip install django
django-admin startproject Projekt

asp net core

Grundaufbau einer asp net core Anwendung und Installieren von asp net core mvc

dotnet new mvc -au Individual -o Projekt

Django App erstellen

Erstellen einer Django App innerhalb eines Django Projekts namens App
{{c1::python manage.py startapp App}}

Spring Boot Controller erstellen in mvc

Erstellen eines Controllers in Spring Boot MVC namens Start.
Mit der URL /start und der Methode index wird das Template index.html ausgegeben.

{{c1::@Controller}}
{{c1::public class Start {}}
    {{c1::@GetMapping("/start")}}
    {{c1::public String index() {}}
        {{c1::return "index";}}
   {{c1::}}}
{{c1::}}}

views.py

Funktion namens home erstellen und das Template home.html ohne Parameter in der Datei views.py in Django verwenden.
{{c1::def home(request):}}
    {{c1::return render(request,'home.html')}}

Asp net core Controller

Erstellen eines Controllers in ASP.NET Core MVC namens StartController. Die Methode Index gibt das Template Index aus.   
{{c1::public class StartController : Controller}}
    {{c1::{ }}
        {{c1::public IActionResult Index()}}
        {{c1::{ }}
            {{c1::return View();}}
        {{c1::} }}
    {{c1::} }}

Django Model erstellen

Erstellen eines Models in Django mit dem Namen Artikel. Attribut titel
{{c1::class Artikel(models.Model):}}
    {{c1::titel = models.CharField()}}
{{c1::def __str__(self):}}
    {{c1::return self.titel}}

ASP.NET Core DbContext

Artikelmodell in ApplicationDbContext hinzufügen

public class ApplicationDbContext : IdentityDbContext
{
    {{c1::public DbSet<Artikel> Artikels { get; set; }}}
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }
}

Hinweis: Diese Inhalte wurden mit Unterstützung von Künstlicher Intelligenz erstellt und redaktionell überprüft (Transparenzhinweis gemäß Art. 50 EU AI Act).