Giter Site home page Giter Site logo

talkpython / anvil-course Goto Github PK

View Code? Open in Web Editor NEW
118.0 11.0 48.0 527 KB

Course demo code and other hand-out materials for our Anvil: Web apps with nothing but Python course

Home Page: https://talkpython.fm/anvil-course

License: MIT License

Python 55.30% HTML 5.55% CSS 39.15%
anvil python python3 web fullstack

anvil-course's Introduction

Anvil: Web apps with nothing but Python

Course demo code and other hand-out materials for our Anvil course.

Take this course for free at talkpython.fm/anvil-course.

Course Summary

Building data-driven web apps is tough. Yes, Python makes it easier than most languages, but you need to know a host of different languages and technologies and they have to fit together just right. This usually includes Python, HTML, CSS, SQL, Linux, a database server, and maybe even JavaScript. But with Anvil, you can create full stack, data-driven web apps with only Python. You write Python on the backend and Python on the client-side. The HTML and CSS are handled with Anvil's drag-and-drop visual editor. The database is seamlessly connected back to your application. And this is the course to teach you how to be effective with Anvil and Python to build data-driven web applications.

What's this course about and how is it different?

This is the definitive course on building web apps with Anvil and Python. It covers the core concepts for sure: forms, design components, and databases. But also covers building an ecommerce web application from scratch including secure user management.

In this course, you will:

  • Creating your first Anvil web application
  • How Anvil seamlessly mixes a single page browser-based app with a backend
  • Using the form designer to create visually interesting user interfaces
  • Understand how the code-behind Python integrates with the UI elements
  • Add validation for user input
  • Navigate between multiple forms without reloading the application
  • Create user accounts and allow login from multiple sources
  • Model data in the Anvil database service
  • Insert into and query data from the database service
  • Integrate Plotly plots for interactive charts and graphs
  • Build HTTP endpoints and custom APIs for your Anvil app
  • Host your application on a custom domain, including SSL support
  • Add Stripe credit card support to allow for purchases directly within the application
  • And lots more

View the full course outline.

Who is this course for?

Anyone who has struggled to create a proper web application and would like to use their existing Python knowledge to entirely create a full stack web app without SQL, CSS, HTML, JavaScript and all the rest.

This course assumes some basic knowledge of Python. It does not use advanced features of the language in significant ways so basic knowledge may be sufficient. But the course is not a beginner Python course, so students with little to no Python language experience should take a foundational course first. We recommend our Python Jumpstart by Building 10 Apps as a prerequisite if needed.

anvil-course's People

Contributors

mikeckennedy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anvil-course's Issues

Is it safe to cache measurements across user sessions?

Hi!
in the data_access file, you cache the measurements, but you do not clear the cache when the user logs out. Wouldn't that mean that if another user signs in on the same computer, he would get access to the cached measurements of the previous user? (The same applies to my_ave).

I loved the course, by the way! Anvil seems to be a lot easier to get started with than the traditional web frameworks.

Navigation not defined when import navigation module to AddMeasurementComponent

Hello @mikeckennedy ,

Going through your talkpython.fm tutorial. Great tutorial by the way, thank you for it. Running into issues on the 'Navigating between views' video (https://training.talkpython.fm/player/course/anvil-web-apps-with-just-python/lecture/210406)

I know this was an issues that was brought up back in February. I tried using your proposed solution of project_name.modulename , so my import statements (listed below)

from ._anvil_designer import AddMeasurementComponentTemplate 
from anvil import * 
from Finessd.navigation import *

which solved the issue getting the Add Measurement page running but when I added in values and hit 'Add Measurement' button I got back an error -

NameError: name 'navigation' is not defined
at AddMeasurementComponent, line 38

Any suggestions how to resolve this? Unfortunately, looking in the Anvil import docs hasnt been too helpful.

Navigation module code for reference

from AddMeasurementComponent import AddMeasurementComponent
from HomeAnonComponent import HomeAnonComponent
from ProgressComponent import ProgressComponent
from AccountComponent import AccountComponent
from HomeDetailsComponent import HomeDetailsComponent
from SetHeightComponent import SetHeightComponent

# this navigation component is going to need access to the home form

home_form = None

def get_home_form():
  if home_form is None:
    raise Exception ('You must set the home form first.')
    
  return home_form



def go_add():
  """This method is called when the link is clicked"""
#     self.link_add.role = 'selected'
#     cmpt = AddMeasurementComponent()
  set_title("Add Measurement")
  set_active_nav("add")
  form = get_home_form()
  form.load_component(AddMeasurementComponent())

def go_home():
  """This method is called when the link is clicked"""
  set_title("")
  set_active_nav("home")
  form = get_home_form()
  form.load_component(HomeAnonComponent())

def go_progress():
  """This method is called when the link is clicked"""
  set_title("Progress")
  set_active_nav("progress")
  form = get_home_form()
  form.load_component(ProgressComponent())

def go_account():
  """This method is called when the link is clicked"""
  set_title("Your Account")
  set_active_nav("account")
  form = get_home_form()
  form.load_component(AccountComponent())

AddMesurementComponent code

from ._anvil_designer import AddMeasurementComponentTemplate
from anvil import *

from Finessd.navigation import *

class AddMeasurementComponent(AddMeasurementComponentTemplate):
  
  def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)

    # Any code you write here will run when the form opens.

    self.weight = 0
    self.rate = 0
    self.date = None
    
    
    
  def button_save_click(self, **event_args):
    """This method is called when the button is clicked"""
    self.label_error_msg.visible = False
    
    error = self.sync_data()
    if error:
      self.label_error_msg.text = error
      self.label_error_msg.visible = True
      
      return
    
    print("Would have saved the measurement: {} {} {}".format(
      self.weight, self.rate, self.date)
         )
    
    # Next step measurements are saved to db
    # What happens next after button click?
    # TODO item: Go to progress page? view recent measurements added?
    navigation.go_home()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.