.\using_parameter.ps1 : Ein Parameter mit dem Namen "Debug" wurde mehrfach für den Befehl definiert.
In Zeile:1 Zeichen:1
+ .\using_parameter.ps1
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [], MetadataException
+ FullyQualifiedErrorId : ParameterNameAlreadyExistsForCommand
Using Jenkins as an automation server for your development, you can automate such repeating tasks as testing and deploying your app.
Starting with a sample Groovy App (a simple calculator) with tests, you will learn how to integrate your app in Jenkins and build a pipeline, so that Jenkins runs the desired tasks every time, you change the code.
You should clone the demo repository into you demo account, because you may change some file during this post., and you will not get write permissions for the demo repository.
Also, clone the repository to your local machine to see what our demo app looks like.
$ cd SampleApp_GroovyCalculator/
$ ls
Jenkinsfile README.md bin build.gradle gradlew src
Makefile SampleCalculator build gradle settings.gradle
The first task, Jenkins will do in our pipeline: build your app
$ ./gradlew build
Because it’s the first time you start gradlew, the required software will be downloaded:
First: the current Gradle Version (Gradle is the Build Tool used by Groovy Projects)
Downloading https://services.gradle.org/distributions/gradle-6.2.1-bin.zip
………10
Welcome to Gradle 6.2.1!
Here are the highlights of this release:
- Dependency checksum and signature verification
- Shareable read-only dependency cache
- Documentation links in deprecation messages
For more details see https://docs.gradle.org/6.2.1/release-notes.html
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
After this, your app will be tested
> Task :test
Calculator02Spec > two plus two should equal four PASSED
Calculator01Spec > add: 2 + 3 PASSED
Calculator01Spec > subtract: 4 - 3 PASSED
Calculator01Spec > multiply: 2 * 3 PASSED
BUILD SUCCESSFUL in 34s
5 actionable tasks: 5 executed
Perform the build again
No download is required. The build is much quicker.
mvn -U archetype:generate -Dfilter="io.jenkins.archetypes:global-configuration-plugin"
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 32 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 44 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml (918 B at 18 kB/s)
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.1.2:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.1.2:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> io.jenkins.archetypes:global-configuration-plugin (Skeleton of a Jenkins plugin with a POM and an example piece of global configuration.)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose io.jenkins.archetypes:global-configuration-plugin version:
1: 1.2
2: 1.3
3: 1.4
4: 1.5
5: 1.6
Choose a number: 5:
[INFO] Using property: groupId = unused
Define value for property 'artifactId': com.examples.jenkins.plugins
Define value for property 'version' 1.0-SNAPSHOT: :
[INFO] Using property: package = io.jenkins.plugins.sample
Confirm properties configuration:
groupId: unused
artifactId: com.examples.jenkins.plugins
version: 1.0-SNAPSHOT
package: io.jenkins.plugins.sample
Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: global-configuration-plugin:1.6
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: unused
[INFO] Parameter: artifactId, Value: com.examples.jenkins.plugins
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: io.jenkins.plugins.sample
[INFO] Parameter: packageInPathFormat, Value: io/jenkins/plugins/sample
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: io.jenkins.plugins.sample
[INFO] Parameter: groupId, Value: unused
[INFO] Parameter: artifactId, Value: com.examples.jenkins.plugins
[INFO] Project created from Archetype in dir: /Users/Shared/CLOUD/Kunde.BSH/workspace/SamplePlugin_Config/com.examples.jenkins.plugins
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.525 s
[INFO] Finished at: 2020-03-01T17:28:27+01:00
[INFO] ------------------------------------------------------------------------
Verify Plugin
cd com.examples.jenkins.plugins
mvn verify
Run Plugin
mvn hpi:run
Working with Groovy Scripts
Include a common groovy script in Jenkins file
1: Create a common.groovy file with function as needed
def mycommoncode() {
}
2: In the main Jenkinfile load the file and use the function as shown below
node{
def common = load “common.groovy”
common.mycommoncode()
}
Basic example of Loading Groovy scripts
File example.groovy
def example1() {
println 'Hello from example1'
}
def example2() {
println 'Hello from example2'
}
The example.groovy script defines example1 and example2 functions before ending with return this. Note that return this is definitely required and one common mistake is to forget ending the Groovy script with it.Jenkinsfile
Continuing the demo from the last section, we now put the Groovy code into a callable function in a script called “github.groovy”. Then, in our Jenkinsfile, we proceed to load the script and use the function to process JSON response from Github API.github.groovy
If you follow the first part of this blog topic, you have a running Django dashboard.
But, the content ist still static. Lets review the current state:
Prepare our Django project
Right now, the whole content of our Django project is provided by the dashboard template
dashboard/template/site/base.html
Looking at our web site, you will see the different side menu items. So, intentionally, our web site should display different pages. And each page should provide the dynamic content.
The final goal of this part is to change our web app, so that each side item navigates us to a different page. For this, we have to take care about two things:
Navigation: how to we get to another page in our app
Project Structure: where to place the required components for each page
Basics of Navigation
Navigation usually is the process of getting from one page to another by clicking on a link.
So, we need to things:
the source page, containing the link
the destination page
the link, pointing to the destination page
Let’s take a look into the site template with the side menu:
Linking to a html page is not possible, because Django does not work with html pages. Navigation in Django works with urls (in urls.py) and views in (views.py).
We must replace the html link tag (<a href="buttons.html">) with an Django-conform code. Read here for more details and the basics.
The idea behind the navigation is
Define the needed links
/buttons
Give each link a name
“buttons”
Define, which view to call for this link
components/buttons/views.py
Tell Django, how to insert this link in a html page
<a href="{
With this in mind, we change our site template for the side navigation (e. g. for the components menu):
But, if you save the template and try to view the web page, you will see this error:
We missed to tell Django, what to do when the corresponding link for this name is requested. We have to tell Django to use the view defined in buttons/views.py to generate the resulting view/page.
So, change the global url mapping file dashboard/urls.py
Each template base.html should have the following content:
{
{
{
And each corresponding view.py file should have the following content, only the template_name should be different (the name of the template base.html file)
from django.views import generic
class IndexView(generic.TemplateView):
template_name = 'buttons/base.html'
So, for each template file, we have to
locate the corresponding html file from the install folder (see table above)
copy the content between these tags to the template file:
If you follow the first part of this blog topic, you have a running Django dashboard.
But, unfortunately, the content is still static. Let’s review the current state:
Perfect. We are done with the basic setup.
Still, some work to do, because our dashboard is only a static dashboard. All content is programmed in the dashboard template file dashboard/templates/site/sb-admin-2/base.html
For example, look at the cards with the earnings at the top:
To achieve a more dynamic content, we need to move the desired parts of the dashboard from the template file to the frontend view file.
We will do this by following these steps:
Identify the dynamic parts
Move these parts from the template into for frontend view template index.html
Modify frontend view.py to generate dynamic content from data
Identify dynamic parts
How to find the parts, which are dynamic.
One way is to ask:
Which parts should be on every page (unchanged) and
What should change on every page
You mostly get the same answers by the question:
What are the main components of a web page (including navigation and content)
For answer the first question, take a look at the current page and “name” the areas:
So, these “names” are also the answer for the 3. Question:
sidemenu
top bar
content
And maybe you find additional “names”
header
footer
top menu
left and right sidebar
Find identified parts in template
Next step is, to find the identified parts in our dashboard template
dashboard/templates/site/sb-admin-2/base.html
This is an easy step, because the developer of the SB Admin 2 template documented their template well:
Looking into the code of the template, you will find comment lines describing the content:
<!-- Sidebar -->
<!-- Topbar -->
<!-- Top Search -->
<!-- Top Navbar -->
<!-- Begin Page Content-->
So, it is obvious what do to next:
get the dynamic part (lines under)<!-- Begin Page Content--> the green box in the following image
move it to the frontend template
place some information in the dashboard template, that the real content should be displayed here the blue curly braces in the following image
This is the way, the template system of django works:
Let’s explain this with a simple example: the page title
We declare a title (which should be considered as the default title). And in the frontend page, we declare the title for this page (the frontend page).
To achieve this, we have to tell our template system the following:
Now, we do the same with the content:
Looking at our resulting page, nothing changes. This is the desired result, but how could we be sure, that we really change the structure?
Well, let’s make a test and try to include a different content in the dashboard template.
Change the lines, where we include the content into this:
{
MISSING CONTENT
{
Did you notice the other name of the content: content_missing?
Change the template, save the file and have a look at the result:
Change content back, so your template is working again:
{
MISSING CONTENT
{
The final step in Part 3 will be replacing all static content of the dashboard with dynamic content.
Building a complete web app isn’t always an easy task. Designing and Implementing on both sides (backend and front-end) requires mostly a lot of knowledge. So, why don’t using tools or framework, which helps and makes our life easier. Django is one of these frameworks:
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development
So, let’s get started.
Create project
For subsequent steps, we will remember our starting directory
❯ DASHBOARD_ROOT=$(pwd)
❯ echo $DASHBOARD_ROOT
... here you will see your current folder...
{
{
{
{
{
<main>
<div class="p-5 mb-4 bg-body-tertiary rounded-3">
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">Custom jumbotron</h1>
<p class="col-md-8 fs-4">Using a series of utilities, you can create this jumbotron, just like the one in
previous versions of Bootstrap. Check out the examples below for how you can remix and restyle it to
your liking.</p>
<button class="btn btn-primary btn-lg" type="button">Example button</button>
</div>
</div>
</div>
</main>
{
Still some work to do, because our dashboard is only a static dashboard. All content is programmed in the dashboard template file dashboard/templates/site/sb-admin-2/base.html
For example, look at the cards with the earnings at the top:
To achieve a more dynamic content, we need to move the desired parts of the dashboard from the template file to the front-end view file.
One of the most challenging things in software development is state management.
Motivation
What is a state (or application state)? Theoretically, it is the entire memory of the application, but, typically, it is the data received via API calls, user inputs, presentation UI State, app preferences, etc.
It is the data that can differentiate two instances of the same application.
One example of application state would be a list of customers or products maintained in an application.
Problem (we’re trying to solve)
Think of an application using a list of data (products, customers, …). This list is the state that we are trying to manage.
Some API calls and user inputs could change the state ( i.e. the list ) by adding or removing items/entries. The state change should be reflected in the UI and other dependent components.
We could solve this with a global variable to hold the list and then add/remove customers from/to it and then write the code to update the UI and dependencies. But, there are many pitfalls in that design which are not the focus of this article.
Solutions
Currently there are several state management libraries for Angular apps: NGRX, NGXS or Akita.
RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. This project is a rewrite of Reactive-Extensions/RxJS with better performance, better modularity, better debuggable call stacks, while staying mostly backwards compatible, with some breaking changes that reduce the API surface
Store is RxJS powered state management for Angular applications, inspired by Redux. Store is a controlled state container designed to help write performant, consistent applications on top of Angular.
Key concepts
Actions describe unique events that are dispatched from components and services.
State changes are handled by pure functions called reducers that take the current state and the latest action to compute a new state.
Selectors are pure functions used to select, derive and compose pieces of state.
State is accessed with the Store, an observable of state and an observer of actions
Akita is a state management pattern, built on top of RxJS, which takes the idea of multiple data stores from Flux and the immutable updates from Redux, along with the concept of streaming data, to create the Observable Data Stores model.
Akita encourages simplicity. It saves you the hassle of creating boilerplate code and offers powerful tools with a moderate learning curve, suitable for both experienced and inexperienced developers alike.
Akita is based on object-oriented design principles instead of functional programming, so developers with OOP experience should feel right at home. Its opinionated structure provides your team with a fixed pattern that cannot be deviated from.
NGXS is a state management pattern + library for Angular. It acts as a single source of truth for your application’s state, providing simple rules for predictable state mutations.
NGXS is modeled after the CQRS pattern popularly implemented in libraries like Redux and NgRx but reduces boilerplate by using modern TypeScript features such as classes and decorators.
State is basically everything that will define the UI that our user will be using. State could be whether a button should be visible or not, it could be the result of that button click and it could also be an Array of users that is coming from an API. State can live in different places throughout our entire application. Some state is very specific to a certain component where other state might be shared in different parts of our application. One piece of state could be a singleton instance, where a another piece of state could share the limited lifespan of a component that can be destroyed at any time.
This big variety of what state could be, how long it lives and where it comes from results in complexity that we need to manage.
What is state management?
State management is the concept of adding, updating, removing and reading pieces of state in an application. When we have deeply nested data structures and we want to update a specific part deep down in the tree, it might become complex. In that case we have state management libraries that contain a Store which helps us with state management to get rid of that complexity. A quick note, we have to be careful that these libraries don’t add complexity by overusing them.
Reactive state
Combining state management together with reactive programming can be a really nice way to develop single-page-applications. Whether our focus lies on Angular, Vue or React, combining these two principles will result in more predictable applications.
Now what has state to do with reactive programming? A piece of state can change over time, so in a way we are waiting for new state changes. That makes it asynchronous.
The sidebarCollapsed$ stream starts out with false, later on it becomes true and so on. This stream keeps on living. In Angular this state can be consumed with the async pipe as easy as:
The async pipe will subscribe to the sidebarCollapsed$ pass it to the component, mark it for check and will automatically unsubscribe when the component gets destroyed. Keeping state in an observer pattern is nice because we can subscribe to the changes. Oh, and did I mention it plays super nice with Angular?
We can either use a BehaviorSubject or state management frameworks that support Observables. Here are some really great ones with Observable support:
Before we dive deeper in state, there are 2 important principles that we should follow when managing state. The first principle is immutability, which means that we should never mutate data directly without creating a new reference of that object. If we mutate data directly, our application becomes unpredictable and it’s really hard to trace bugs. When we work in an immutable fashion we can also take advantage of performance strategies like the ChangeDetection.OnPush from Angular or React its PureComponent.
When we use typescript we can enforce the typescript compiler to complain when we mutate data
type Foo = {
readonly bar: string;
readonly baz: number;
}
let first = {bar: 'test', baz: 1};
first.bar = 'test2'; // compilation error
first = {...first, bar: 'test2'}; // success
In the previous example we have overwritten the first instance with an entire new instance that has an updated bar property.
Arrays can be handled like this:
let arr = ['Brecht', 'Kwinten'];
arr.push('John'); // BAD: arr is mutated
arr = [...arr, 'John']; // Good, arr gets new reference
the Array prototype also has some great helper functions that we can use to enforce immutability like map() and filter() but this is not in scope for this article.
The second principle is Unidirectional data flow. In a nutshell, this means that we should never use two-way data binding on state. It is the absolute owner of that specific piece of state that is in charge of updating it (immutable of course).
Both of these principles are highly enforced by the Redux pattern.
What kind of states are there?
Router state
Often forgotten, but one of the most important pieces of state a web application can have. Putting state in the route gives us the following advantages:
We can use the browser navigation buttons
We can bookmark the state
We can can copy and paste the url with the state to other users
We don’t have to manage it, it’s always there in the route
Tip: Instead of handling modals with a userDetailModalVisible property, why not enjoy all the benefits mentioned above and bind it to a users/:userId route? Using a child router-outlet in Angular makes this a piece of cake as we can see in this snippet.
<table>
<!--contains users -->
</table>
<router-outlet>
<!-- user detail modal rendered in here -->
</router-outlet>
Component state
Every component could contain state. That state could be shared with its dumb components or could be used in the component itself. Eg: When an ItemComponent has a property selectedItems which is an array of ids, and that array is never used in other components (that aren’t children of that component), we can consider it component state. It belongs to that component, therefore the component should be responsible for it. Child components can consume that state but should never mutate it. Those components can notify their parent that is responsible for it, which could update it in an immutable way. For more information about smart and dumb components look here.
Personally, I try to avoid state management frameworks for managing component state because it’s the responsibility of that component to manage that state. There are however good reasons to use state management frameworks to manage component state:
If the state management of the component becomes a bit too complex and we don’t want to use a state management framework just yet, we could use a state reducer in the component itself.
Persisted state
Persisted state, is state that is being remembered when the user navigates between different pages. This could be whether a sidebar was collapsed or not, or when the user returns to a grid with a lot of filters and he wants them to be remembered and reapplied when he returns. Another example is a wizard with different steps, and every step needs to be persisted so the user can navigate back and forth and the last page is a result of all these steps.
Persisted state is the type of state where we typically use a state management framework for, that being said, if we don’t want to rely on an external dependency we can also manage it in a Angular service which can be a singleton that is shared throughout the entire application. If that service becomes too complex or there is a lot of state to manage, I would consider to put that state into a state management framework.
Shared state
When we are talking about shared state, we are talking about state that needs to be shared between different parts of our application. State that is being shared throughout different smart components. This means that the instance of this piece of state should live on a higher level, than the components that want to consume it.
Shared state can be managed in a state management framework like Redux, Ngrx, Akita, Ngxs and so on, but if that state is small and simple we can also manage it manually. Let’s say that we want an Observable of an Array of countries that we need to share throughout the entire application. In Angular we could have a CountryService that fetches the countries from the API once, and then shares it throughout the entire application. For that we can use the shareReplay operator from RxJS.
export class CountryService {
...
countries$ = this.httpClient.get('countries').pipe(shareReplay(1));
}
Simple right, one line of code?! For this we don’t need a state management framework, although it can also have its benefits. Some developers like to keep all their master data in a Redux store, and that’s fine. Just know that we don’t have to. I like to develop by the KISS principle (Keep It Simple Stupid) as much as possible, so I favor this approach many times. Think about the amount of lines of code we saved by this approach. Beware that every line of code we write, not only needs to be written but also maintained.
Which state needs to be managed?
Now that we know what state is, we have to ask ourselves which state needs to be managed, and where do we manage that state? In a component, singleton service or a framework (Store)?
This is the part where the strong opinions surface. I would suggest to use what works for you and your team and really think about, but here are my personal opinionated guidelines:
I try to avoid state management frameworks where possible. RxJS already leverages us with a lot already and I like to think KISS.
I try to avoid using state management frameworks to communicate with different parts in my application, I believe state is unrelated to communication.
When my component can handle the state and it’s not too complex, I let my component in charge of managing that state.
Master data like countries are exposed in a service which uses the shareReplay operator.
I don’t put the result of a getById API call into a store if there is no one consuming that state except for the component requesting it
I use a facade between my smart components and my store/services to make refactoring easier in the future.
However, there is also a popular opinion out there to put literally everything in the store which has the following advantages:
We can see the flow of the code in devtools
Consistent pattern
We can leverage selectors with memoization
Easier for realtime applications
Optimistic updates are easier
However, there are a few downsides as well:
A gigantic amount of bloat code: Bigger bundle size, more maintenance and dev time. Eg: If we would use the complete Ngrx pattern for the countries$ example we would have to write an: action, actiontype, effect and a reducer.
Tightly coupled to a strong dependency that is hard to get rid of in the future
Generally more complex
The user his screen can get out of sync with the backend
Cache invalidation: if we add a currentUserToEdit in the store, we have to get it out when we navigate away
We can’t use the async pipe to cancel pending XHR requests
$ az webapp up --sku F1 -n azure-toolbox-flask-demo -l westeurope
webapp azure-toolbox-flask-demo doesn't exist
Creating Resource group 'xx_xx_Linux_westeurope' ...
Resource group creation complete
Creating AppServicePlan 'xx_asp_Linux_westeurope_0' ...
Creating webapp 'flask-demo' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir .../Working-with_Python ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://via-internet-flask-demo.azurewebsites.net
{
"URL": "http:/azure-toolbox-flask-demo.azurewebsites.net",
"appserviceplan": "xx_asp_Linux_westeurope_0",
"location": "westeurope",
"name": "azure-toolbox--flask-demo",
"os": "Linux",
"resourcegroup": "xx_xx_Linux_westeurope",
"runtime_version": "python|3.7",
"runtime_version_detected": "-",
"sku": "FREE",
"src_path": ".../Working-with_Python"
}
Create Django App with PostgreSQL
Installation PostgreSQL on Mac OS
$ brew install postgres
==> Installing dependencies for postgresql: krb5
==> Installing postgresql dependency: krb5
...
==> Installing postgresql
...
==> Caveats
==> krb5
krb5 is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have krb5 first in your PATH run:
echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.bash_profile
For compilers to find krb5 you may need to set:
export LDFLAGS="-L/usr/local/opt/krb5/lib"
export CPPFLAGS="-I/usr/local/opt/krb5/include"
For pkg-config to find krb5 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig"
==> postgresql
To migrate existing data from a previous major version of PostgreSQL run:
brew postgresql-upgrade-database
To have launchd start postgresql now and restart at login:
brew services start postgresql
Or, if you don't want/need a background service you can just run:
pg_ctl -D /usr/local/var/postgres start
Set user and passwords for postgres database
Create database and user for django app
$ psql postgres
psql (12.1)
Type "help" for help.
postgres=# CREATE DATABASE pollsdb;
CREATE DATABASE
postgres=# CREATE USER manager WITH PASSWORD '########';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE pollsdb TO manager;
GRANT
Download sample repository
$ git clone https://github.com/Azure-Samples/djangoapp.git
$ cd djangoapp
$ python manage.py makemigrations
No changes detected
$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying polls.0001_initial... OK
Applying sessions.0001_initial... OK
$ python manage.py createsuperuser
Username (leave blank to use 'user'): admin
Email address: admin@localhost
Password:
Password (again):
Superuser created successfully.
Run server and acccess web page at http://127.0.0.1:8000/
$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
January 25, 2020 - 16:42:14
Django version 2.1.2, using settings 'azuresite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[25/Jan/2020 16:42:26] "GET / HTTP/1.1" 200 111
[25/Jan/2020 16:42:26] "GET /static/polls/style.css HTTP/1.1" 200 27
Not Found: /favicon.ico
[25/Jan/2020 16:42:26] "GET /favicon.ico HTTP/1.1" 404 2688
Login zu Azure
$ az login
Deploy to App Service
$ az webapp up --sku F1 -n azure-toolbox-django-demo -l westeurope
webapp azure-toolbox-django-demo doesn't exist
Creating Resource group 'xx_xx_Linux_westeurope' ...
Resource group creation complete
Creating AppServicePlan 'xx_asp_Linux_westeurope_0' ...
Creating webapp 'flask-demo' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir .../Working-with_Django ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://via-internet-django-demo.azurewebsites.net
{
"URL": "http:/azure-toolbox-django-demo.azurewebsites.net",
"appserviceplan": "xx_asp_Linux_westeurope_0",
"location": "westeurope",
"name": "azure-toolbox--django-demo",
"os": "Linux",
"resourcegroup": "xx_xx_Linux_westeurope",
"runtime_version": "python|3.7",
"runtime_version_detected": "-",
"sku": "FREE",
"src_path": ".../Working-with_Django"
}
$ brew update && brew install azure-cli
$ az login
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.