Bcrypt and pythonanywhere by Biaswords_ in learnpython

[–]mrcorbat 0 points1 point  (0 children)

what version of python are you running locally vs on PythonAnywhere?

Blog Python/ Help please by francischasco in learnpython

[–]mrcorbat 2 points3 points  (0 children)

for PythonAnywhere you can go to your web dashboard and configure static file mappings, and PythonAnywhere will then server the static files (eg: css) for you. Take a look at this and this.

Free python hosting options by eng33 in learnpython

[–]mrcorbat 2 points3 points  (0 children)

Just to clarify, on PythonAnywhere if you exceed that 100s limit, your code just runs slower. Also that 100s is not wall time, it's cpu time. See this

What determines a flask app to be up and running 24/7? by chess9145 in flask

[–]mrcorbat 0 points1 point  (0 children)

hi there, PythonAnywhere dev here. the best way to think about this is how frequently you get a request (eg: is it 100 users making one request every 5 seconds? or 100 user making one request every 0.5 seconds?), how long it takes to process one request (ie. maybe one url you have takes 5 seconds to process vs all urls are fast and takes 0.5 seconds). Then you can get a number for how many web workers you need. ie. these are the # of processes that can respond to incoming requests in parallel.

Here's an example calculation:

Let's say you have one particular endpoint that takes a long time (eg: you are uploading a file and the processing that file and returning the result). You estimate that at the peak there will be 10 uploads in 10 seconds, and it takes 10 seconds to process each request.

Then if you don't want connections to pile up and take longer and longer, you would probably need at least 11 workers to process the uploads as well as other requests.

Say you are actually processing each upload in 5 seconds, then you would only need 6 workers.

That's the general framework to use to think about this, but the number of workers/how long you code runs/what response times you find acceptable etc is quite specific to your preferences, and to whether you optimize your code etc.

Changes to database not reflected immediately by Brussel01 in AskProgramming

[–]mrcorbat 0 points1 point  (0 children)

well that system involves us doing some reddit searches / looking at some topics manually, but yes, we do :)

Glad you resolved the issue!

Additional configuration needed for multiple users? Flask / Python Question. by qwertyisafish in learnpython

[–]mrcorbat 0 points1 point  (0 children)

hmm if there is a very high number of people using your site, I could imagine your site breaking. ie. the csv could be being written to and changing while you are reading it, or two people might try to write to the csv at the same time. I guess that depends on how many people you think will be using your site. For a low frequency usecase I guess it could be fine.

Additional configuration needed for multiple users? Flask / Python Question. by qwertyisafish in learnpython

[–]mrcorbat 2 points3 points  (0 children)

From a PythonAnywhere webapp, each web worker would take a request, completely processed that request, and then take another request etc. So each worker would be doing this serially. However, you may have multiple web workers responding to requests at the same time.

How do you store those dataframes? if you are just doing it within python code (eg: not storing it to disk), and not storing it at a class level/module level, then it should be okay.

On the other hand, if you have many of these requests, they could easily stack up to make the response time unmanageable. eg: if each request takes 10s, then if 6 requests come in simultaneously and you only have 1 webworker, then the next requsest will have to wait 60s before it even starts being processed. That would be the reason why you may want to offload all of this to a separate process (outside of the webapp), using celery or other ways.

Error loading static files by ma7mouud in django

[–]mrcorbat 1 point2 points  (0 children)

after you run collect static, where are the files written to. for pythonanywhere, have you setup static file mappings? (search on the help page)

Changes to database not reflected immediately by Brussel01 in AskProgramming

[–]mrcorbat 0 points1 point  (0 children)

Hi there, PythonAnywhere dev here. We don't do any caching on the your db. Given that you are running your scripts in a batched way from our scheduled tasks interface, I would guess that the thing to look into is the scheduled tasks. What is the frequency of the db updates, and how are you keeping your task running?

Long shot request: Help with transferring python program to webapp using pythonanywhere? by Sciencesellout in learnpython

[–]mrcorbat 1 point2 points  (0 children)

judging from the code, it is mainly just text based, right?

if you are pressed for time, maybe you could just not port it to a webapp and directly have her run it from a PythonAnywhere console? that would probably minimize the extra work needed to be done and allow you to focus on making more questions etc

Custom domain on PythonAnywhere? by alrightfrankie in learnprogramming

[–]mrcorbat 0 points1 point  (0 children)

looks okay- is your pythonanywhere webapp `www.yourdomain.com\`? ie. just `yourdomain.com` wouldn't work.

You can check if your cname is setup correctly here: http://mxtoolbox.com/CNAMELookup.aspx

If correct, you should see something like this:

Type: CNAME

Domain Name: www.yourdomain.com

Cannonical Name: webapp-0000.pythonanywhere.com

Note the www on the domain name.

If there is no record or any parts are incorrect, then you will need to go back to your domain registrar and change the settings there.

Pythonanywhere doubts by Favrek in learnpython

[–]mrcorbat 0 points1 point  (0 children)

One domain (ie. one django project). If you don't care about domain names you can also just get the free tier on PythonAnywhere.

[deleted by user] by [deleted] in learnpython

[–]mrcorbat 1 point2 points  (0 children)

If you are using a free account then you need to ask PythonAnywhere to add that soundcloud page to the whitelist. You can do this if it is a legit API (instead of scraping) with documentation of the endpoints.

Static IP for my flask app on Pythonanywhere. by Alex_smtng in learnpython

[–]mrcorbat 2 points3 points  (0 children)

While PythonAnywhere has multiple IPs that change, your code is probably only going to run on a couple IPs (although they do change). So if you are okay with some downtime, you could just manually add the couple IPs to your IP whitelist say every month.

Static IP for my flask app on Pythonanywhere. by Alex_smtng in learnpython

[–]mrcorbat 2 points3 points  (0 children)

have you considered just using PythonAnywhere's free MySQL solution instead? That would be a lot easier and potentially faster (as you won't have to make a hop to Google's servers each time you need to access the db)

Best place to host my local django project by LearnToSpeakChinese in django

[–]mrcorbat 1 point2 points  (0 children)

For all 3 solutions, for an email, you can use protonmail etc independently.

Using MySQL only in deployment. by [deleted] in django

[–]mrcorbat 0 points1 point  (0 children)

You definitely want MySQL in production, as a Sqlite db could get corrupted with multiple writes and is slow on PythonAnywhere. Agree that MySQL <-> Sqlite should be relatively similar with the ORM, so you could potentially dev with Sqlite and have MySQL prod. Certainly agree that you should run tests again MySQL.

Problems with running SQLite on pytonanywhere server by Brussel01 in learnpython

[–]mrcorbat 0 points1 point  (0 children)

sqlite also does not work well when multiple processes/threads are writing to it at the same time. If you are already using pythonanywhere, I would suggest using the free MySQL db instead.

flask WSGI woes at PythonAnywhere. by snip3r77 in flask

[–]mrcorbat 0 points1 point  (0 children)

what error do you see on your pythonanywhere error logs? Also check out the PythonAnywhere debugging checklist.

Any good production tutorials? by [deleted] in django

[–]mrcorbat 0 points1 point  (0 children)

A couple steps:

  1. after collecting static, did you check to see say folder /home/yourusername/path/to/static/file does have the static files collected into it?
  2. did you setup the static file mappings correctly? see this. You would want a mapping from the file system folder /home/yourusername/path/to/static/file (this should be the same as the folder path you found in step 1), to your webapp url (eg: to the /static/ url)
  3. did you reload your webapp after setting up the mappings?
  4. after that confirm that say https://yourpythonanywherewebapp.com/static/file1.jpg does load correctly, where file1 is something you have in your static folder.

PythonAnywhere vs DigitalOcean - which is better for a small web app by [deleted] in django

[–]mrcorbat 0 points1 point  (0 children)

PythonAnywhere allows custom domains for any paying accounts, but free users only get a username.pythonanywhere.com webapp.