I built a cute e-shop entirely in Python

I’m pretty new to web development and am still learning HTML, CSS and JS. I work for Anvil, a platform that allows you to build and deploy full-stack web apps with only Python. It’s great for someone like me with an ML background and no web dev experie…


This content originally appeared on DEV Community and was authored by Brooke Myers

I'm pretty new to web development and am still learning HTML, CSS and JS. I work for Anvil, a platform that allows you to build and deploy full-stack web apps with only Python. It's great for someone like me with an ML background and no web dev experience.

I'm learning HTML and CSS by styling Anvil apps, so I built a fake online shop using Anvil and tried to make it as pretty as possible with my limited CSS knowledge. Check it out and let me know what you think!

GIF of shop app

Styling Python Components

Anvil is a drag-and-drop web app builder where every UI component is a Python object. I styled some of these components with CSS by applying a role to them.

For example, the header images in the app are ColumnPanels styled with a CSS role.

.anvil-role-header-photo {
  background: url(_/theme/header.jpg);
  min-height: 700px;
  background-attachment: fixed;
  background-size: cover;
}

TextBoxes and TextAreas have a solid blue border and items in the Cart have a top and bottom border added.

But for someone who has little experience with CSS, it wasn't too difficult to make an Anvil app look unique!

Built-in Integrations

Purchases in my app are made through Stripe which is already integrated in Anvil, so I didn't have to do much work there. I just added this to my client-side Python:

charge = stripe.checkout.charge(amount=self.subtotal*100,
                                      currency="USD",
                                      shipping_address=True,
                                      title="Cupcakes & Co.",
                                      icon_url="_/theme/cupcake_logo.png")

Google services are also already built-in to Anvil, so I added a Google map to the Contact page with a marker to match the theme.

Image

    self.map_1.center = GoogleMap.LatLng(40.7128, -74.0060)
    self.map_1.zoom = 15
    icon = GoogleMap.Icon(url="_/theme/maps-icon.png")
    self.marker = GoogleMap.Marker(animation=GoogleMap.Animation.DROP, 
                              position=GoogleMap.LatLng(40.7128, -74.0060),
                              icon = icon)
    self.map_1.add_component(self.marker)

You can check out the source code here!


This content originally appeared on DEV Community and was authored by Brooke Myers


Print Share Comment Cite Upload Translate Updates
APA

Brooke Myers | Sciencx (2021-04-15T15:43:54+00:00) I built a cute e-shop entirely in Python. Retrieved from https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/

MLA
" » I built a cute e-shop entirely in Python." Brooke Myers | Sciencx - Thursday April 15, 2021, https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/
HARVARD
Brooke Myers | Sciencx Thursday April 15, 2021 » I built a cute e-shop entirely in Python., viewed ,<https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/>
VANCOUVER
Brooke Myers | Sciencx - » I built a cute e-shop entirely in Python. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/
CHICAGO
" » I built a cute e-shop entirely in Python." Brooke Myers | Sciencx - Accessed . https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/
IEEE
" » I built a cute e-shop entirely in Python." Brooke Myers | Sciencx [Online]. Available: https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/. [Accessed: ]
rf:citation
» I built a cute e-shop entirely in Python | Brooke Myers | Sciencx | https://www.scien.cx/2021/04/15/i-built-a-cute-e-shop-entirely-in-python/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.