Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Eric Palmer
    @DaddyOh
    Hi all. Just dropping in to let you know of a new project at the U of Richmond. We are migrating 187 web sites (PHP 5.6) to PHP7 and have decided to replace calls to two monolithic PHP libraries and Zend Framework to discreet API EndPts (RestFul). The API endpoint system will be container-based and all python. LDAP and Oracle services will be the bulk of the services offered. We are evaluating fastAPI web framework first and will deploy likely with OpenShift on RHEL7. The container deployment choice belongs to the data center director. Our small team of 3 has 2 of us doing python and now the 3rd is writing a development plan that includes some of Michael's courses and Real Python courses. Oh, this is a low volume service and not expected to be scale limited.
    Jacqueline Wilson
    @jaclynn1_twitter
    That actually sounds really fun @DaddyOh
    Eric Palmer
    @DaddyOh
    @jaclynn1_twitter So far it has been. 15 months to get the php migrated. So much to learn and I love learning/
    Jacqueline Wilson
    @jaclynn1_twitter
    Same here. Sounds like an interesting project. I’m jealous.
    Muhammad
    @mraza007
    Hi guys I’m trying to write a CLI app
    What python libraries I can use which is similar to ncurses
    Rick Yentzer
    @ryentzer
    Anyone here build websites for a living? What is your Python framework of choice to do so? I know of Django and Flask. I've never used Django, but I have built a few web apps with Flask, just not websites.
    Chris May
    @_ChrisMay_twitter
    I've been building websites for a living for over 10 years. The three frameworks I use the most are Django, Pyramid, and Flask.
    Django, for when I want to use a CMS, or when the project is a little unclear and will probably be able to pull in apps from the community
    Flask, for projects that will probably be more API than anything else
    And Pyramid for any project that we might write most of the code for, and will be more than just APIs.
    Rick Yentzer
    @ryentzer
    Awesome. I guess I need to give Django a solid look. I've been building WordPress sites and themes for 10+ years, but I'm in the process of learning Python and want to use it for websites also, not just web apps. Thanks!
    Chris May
    @_ChrisMay_twitter
    Yeah! Would you say you might use Wordpress more as a CMS or as a way to serve websites? (If you could say either?)
    If you are more on the CMS side, django has one of the best CMSs I've ever used: https://wagtail.io/
    Rick Yentzer
    @ryentzer
    More to serve a website where the content is written by the marketing team, and a designer who is familiar with WP.
    Wagtail looks nice. That may fit the bill for our corporate site.
    Chris May
    @_ChrisMay_twitter
    Ah, yeah, then Wagtail will probably be something you might want to look into. It will give the marketing team a pleasant interface to add and edit content, while giving you the ability to get things done in the coding side
    Rick Yentzer
    @ryentzer
    Great! Thanks for the help.
    Chris May
    @_ChrisMay_twitter
    Sure thing!
    Matthew Feickert
    @matthewfeickert

    Hey all. If you're like me and you like using python3 -m venv for virtual environments but also want some fast venv switching at the command line (Linux/MacOS) then might try this dead simple Bash script of mine — venv-activate— for venv creation and tab complete assisted venv switching. :wave:

    https://github.com/matthewfeickert/venv-activate

    Michael Kennedy
    @mkennedy_twitter

    Hi @matthewfeickert That’s cool! I definitely recommend using something like this. I have this aliased in my shell:

    ```

    venv => python3 -m venv venv && . venv/bin/activate && pip install -U pip setuptools &> /dev/null
    create, activate, and freshen up pip all in one shot.
    Matthew Feickert
    @matthewfeickert

    @mkennedy_twitter Indeed. Hard to get more lightweight than that. :) You make a good point though that there isn't really a clear use case to not upgrade and install pip, setuptools, and wheel — so I've fixed it. :+1:

    The main reason I do a Bash functions rather than something like the above is just because I want to use (some) virtual environments in more ways then just being bound to a single project, and being able to know that if I want physics and stats libraries that I can just tab complete my way there is worth it to avoid interruption at times. :)

    Rick Yentzer
    @ryentzer
    I'm having trouble with the refactoring views with Flask blueprints section. I'm not using requests like it's used in the videos, I'm returning render_template(...) I've created a gist so that you can see my code. app-mod.py is how I got it to work after reading Flask docs. app.py is close to what is used in the course video. https://gist.github.com/ryentzer/c67af920790d750cc2ac1a1223ab501b
    Michael Kennedy
    @mkennedy_twitter
    Hi @_ChrisMay_twitter Agree on your 10 years, 3 framework options. :)

    @ryentzer The problem with blueprints is that Flask does not run your main method. If you start your app as flask run rather than python app.py, it won’t work as is. Also, PyCharm can sometimes detect Flask projects and implicitly use flask run. The fix is to add an else to the main invocation:

    ```

    if __name__ == '__main__':
        main()
    else:
        register_blueprints()
       # and stuff like setup DB that would have been done in main
    Rick Yentzer
    @ryentzer
    That's very helpful. Thanks!
    Michael Kennedy
    @mkennedy_twitter
    @DaddyOh That’s pretty interesting! I bet you’re happy to be moving from PHP to modern Python. :) I’ve heard good things about FastAPI.
    Roger Ying
    @rogerying
    Does anyone get problems with ‘ReferenceError: weakly-referenced object no longer exists” from time to time... and how to solve it?
    def __record_purchase_and_transaction(user, order, charge, amount_paid: float, description: str, payment_type: str,
                                          payment_method: str):
        mongosetup.init_db()
    
        payment = Purchase(payment_type=payment_type,
                           payment_method=payment_method,
                           description=description,
                           paid=True,
                           amount_paid=amount_paid,
                           date_initiated=datetime.datetime.now(),
                           currency_paid=charge.currency,
                           stripe_charge_id=charge.id,
                           item_fee_amount=order.item_total_cost,
                           service_fee_amount=order.service_cost)
    
        order.status = 3  # just for sake of saying that order has been paid + received
        order.purchase_details = payment
        order.save()
    That’s the code that’s causing me trouble... is it because the Order object has been referenced somewhere else? Do I need to recall it from the mongodb?
    Jaren A. Edwards
    @XonViegand_RBLX_twitter
    Hello.
    Can anyone review my text adventure game?
    Its still in its first versions.
    I want someone to tell me what I can do to extend the gameplay without simply doing the same tedious things.
    Like stories, plots, something.
    'code'
    Do you want a portion of code for an example?
    Roger Ying
    @rogerying
    Another question I had was: combining python for entrepreneurs and mongodb; how do you refer to the unique mongodb object from html? Objectid is a bson object and I’m trying to refer to objects passing through as links using {id} in the links
    Thanks
    Jacqueline Wilson
    @jaclynn1_twitter
    Pycon registration now open
    Daniel Söderling
    @dsod
    Would love to see some course&/episode about graphql
    Any future plans of covering that? 🙂 Also... Thank you for all ur awesome content @mkennedy_twitter
    Muhammad
    @mraza007
    https://muhammadraza.me/2018/sending-sms-using-python/
    A free way to send sms to any carrier in US
    Michael Kennedy
    @mkennedy_twitter
    Thanks @jaclynn1_twitter ! Exciting. Hope to see you there.
    Hi @dsod Ok, thanks for the ideas. Nothing yet planned but will keep it in mind.
    Hi @rogerying "how do you refer to the unique mongodb object from html? Objectid is a bson object and I’m trying to refer to objects passing through as links using {id} in the links".
    You just need to come up with some sort of unique identifier. It could be the id itself, but often it's some other thing. Like for example, here is the HTML part from the course listing page that links to the courses:
    <a href="/courses/details/python-language-jumpstart-building-10-apps">

    This part is just the routing to a certain view: /courses/details/ and this part is that unique ID: python-language-jumpstart-building-10-apps.

    When the view is loaded, just do a query in MongoEngine: Course.objects(url=url_part).first()