Deploy a Django web app to Python Anywhere [FREE]
ฝัง
- เผยแพร่เมื่อ 6 พ.ย. 2022
- Deploy a Django web app to Python Anywhere [FREE]
It took some time, but it's finally here. A free way to deploy your Django web app... @danimusbar
Python Anywhere:
www.pythonanywhere.com/
💻 | Python Django: Build an E-commerce store - 2022:
www.udemy.com/course/python-d...
🧑💻 | All of my courses:
www.cloudwithdjango.com/courses
❤️ | My Patreon:
/ cloudwithdjango
📑 | My tech blog:
www.cloudwithdjango.com/
🔶| GitHub:
github.com/CloudWithDjango
Hi all, [PLEASE READ for static /media files]
Please note that you will have to setup your static and media files as well - I'd suggest using Amazon S3.
Here is a tutorial on how to setup Amazon S3:
th-cam.com/video/JQVQcNN0cXE/w-d-xo.html
You will also have to setup your database as well - I'd recommend using a PostgreSQL database.
Here is a tutorial on how to setup a PostgreSQL database with Render for FREE:
th-cam.com/video/AgTr5mw4zdI/w-d-xo.html
After a couple of hours of trial and error, i found your clip and it worked as intended! You sir, are a true gentleman! Thank you!
Hi Daniel,
Thank you for reaching out and for your feedback. I'm very glad to hear that you managed to get things up and running!
The pleasure is all mine!
All the best!
Thank you so much man❤❤. I was so in need of this tutorial. It actually worked completely
My pleasure!
I'm glad that you managed to get things working correctly.
This was just the video I needed. Thanks a lot!😇
My pleasure! :)
Thank you very much for your tutorial, dude. It was helpful for my university project
My pleasure! I'm glad that it was of value to you! :)
bro i dont do this, but thanks. i hope there is a way to migrate it to my domain, i bought. that worked perfectly, now i only hope the static media files will work too. i have my first client, and thats a big project, where i get paid for single steps. you my guy just made me and my worker 100 bucks
Hello bro i developed a django website for real-estate but i used mangodb for backend which settings has to change for deployment and for working backend ?
Thank you very much for this CWD. I really appreciate
It is a great pleasure! Thank you for watching :)
Good stuff! Thanks.
Very well explained. Works really well. Thanks 🙏🙏
Thank you for your feedback. I appreciate it!
My pleasure. I'm glad that it helped!
Thank you so much! Just a perfect tutorial!
My pleasure!
Thank you! I'm glad that you liked it!
Great Tutorial for Quick Deploying Django Website. Thank you
Thank you! I'm glad that you enjoyed it!
Great tutorial! Subscribed!
Thank you! I really appreciate your feedback and the sub!
I barely comment on any video but you made my day , It works for I was searching here and there from last two days and it works for me ,Thank so much ,Even I have python 3.12 version but after getting no way I put 3.9 and it works for me , IDK how ,BTW ,Thank you so much for the video
Thank you so much for your kind words and for deciding to comment on my video. I appreciate all the support! Glad to hear that you managed to get a solution working! Yes, unfortunately, PythonAnywhere takes time to support the newer python versions on it's platform. In good time 3.12 will be supported. It's a great pleasure! I wish you all the best!
Thanks so much mate. I was really lost on how to deploy Django.
It's a pleasure! Glad that this video helped you! All the best!
Thanks it worked perfectly!!
My pleasure! I'm glad to hear that! :)
Thanks dude, you've explained so good
My pleasure! Thank you so much!
You are a life saver mate, you have my subscription and my like
Thank you so much!
thank you! you helped me a lot
My pleasure!
I'm glad that my tutorial was of value to you!
All the best,
Thank you bro! I feel like crying! Deployed my first ever web app, Tried many videos many deployment sites like vercel and azure aws but you were the one!
Haha, no worries! I feel that sweet relief 🤣
My pleasure! I'm glad that you managed to get your Django web app deployed on with Nginx :)
thanks very cool and clear instructions
Thank you so much! I'm glad that you enjoyed it!
Awsome, so usefull! thanks!!
My pleasure! I'm glad that you liked the video!
Wow, thank you!!!
It is a pleasure!
Thank you for your Django project deployment tutorial! Your guidance was invaluable, leading to the successful launch of my project. Your expertise has been truly inspiring. You're really professed man kudos to You!
Thank you so much for your kind words! It is much appreciated! I'm glad to hear that you launched your project successfully! All the best to you!
Thanks a lot bro!!
My pleasure!
thanks a lot this really helped
My pleasure! I'm glad that it was helpful to you!
Thanks a lot, very usefull!!
My pleasure! I'm glad that you found the video to be of use!
Tysm for this wonderful video
My pleasure! :) I'm glad that you enjoyed the video.
Thank you so much!
My pleasure!
It worked perfectly!
That's great to hear, Italo!
amazing ! thanks
My pleasure! Thank you, I'm glad that it helped you!
It works thanks
Glad that it works! My pleasure!
Thanks Cloud With Django just deployed my app to ,the web 😋
My pleasure!
I'm glad to hear that you managed to get your app deployed!
Great tutorial, however I am coming across a similar issue mentioned before... the browser returns a page with: Something went wrong :-(
Something went wrong while trying to load this website; please try again later.
I then checked the error logs which say:
Error running WSGI application.
decouple.UndefinedValueError: SECRET_KEY not found. Declare it as envvar or define a default value.
Any tips on how to solve this, my SECRET_KEY is set exactly as is yours in the tutorial. Thanks!
Hi,
Thank you for your feedback.
I'd recommend double checking your configuration settings. That would be the best option.
Here is an alternative solution for you:
Deployment with Render:
th-cam.com/video/AgTr5mw4zdI/w-d-xo.html
The video helped me a lot, but I have images loaded from the admin that do not load on the web, but if they did the localhost, will I have to add a configuration?
Hi,
Thank you for reaching out.
I'm glad to hear that this video helped you out.
Yes, the best way to solve this is to look into hosting your images from Amazon S3 and then making use of collectstatic... This should help with your configuration
Thank you so much 🥺
My pleasure!
what about environment variables, does pythonanywhere supports that or we just need to leave it as it is in the code base ?
Hi,
You'd need to research how to setup environment variables with PythonAnywhere. It should be possible to do so.
THANKS MAN
My pleasure!
Brother my version is python 3.12 so does the procedure suits for me as pythonanywhere only gives us till 3.10 so does it supports here
Hi,
Unfortunately not. You'd need to use 3.10 until 3.12 is available.
Really it helped a lot....
I'm very glad to hear that!
Thank you so much
My pleasure! :)
Yoo, thank you so much😭😭😭😭
My pleasure!!
Hi sir, I did as you said, but my images which I kept in static folder is not showing even the mapping of root is done in setting.py it was working locally. Please Help
Hi,
Please read the pinned comment for further information on static and media files
thanks its work for me
My pleasure! I'm glad that you managed to get everything working!
@cloudwithdjango Thank you for this, Mr Pretorius 🙏
My pleasure! :)
Thank you bro
My pleasure, Walter!
What are other platforms like pythonanywhere that also offer some free tier usage?
Hi,
Thank you for reaching out.
Render and Railway are good alternatives (both offer free tier usage)
Nice Video liked it
Thank you!
thanks for this
My pleasure!
thanks grate video
Thank you!
thanks a lot
My pleasure, Merius!
If we have. Env file in our project then how we can use taht from git hub without publicly exposed.
Hi,
Usually you will create .gitignore file and ignore the .env file for safety
Please am stuck , I don't get it when you ran " mkvirtualenv --python=/usr/bin/python3.9 venv " are we navigating to the install python file on our local machine ? cause it's giving me error.
Hi,
Thank you for reaching out.
No worries. We are creating a virtual environment within the PythonAnywhere environment / terminal not on our local machine
So, to keep it simple all that we are doing is creating a virtual environment via the Python Anywhere terminal
@@CloudWithDjango ok thanks, let me try again.
@@richlueking2627 My pleasure. Good luck :)
I also want to mention that PythonAnywhere isn't always the best solution for everyone, so if you are still struggling, I'd suggest looking at my tutorial on deploying with Render... It is much simpler.
If you'd be interested in that you can check it out here:
th-cam.com/video/AgTr5mw4zdI/w-d-xo.html
Hi. I did as you did. I did it it successfuly. thank you. but there is an issue. Issue is that bootscrap5 is not working. Do you know why is not working?
No worries, glad that you deployed successfully! I'd suggest ensuring that you've set up static files correctly with whitenoise and then I'd recommend setting up bootstrap5 with a library before deployment.
Hello I am getting the following error: Error running WSGI application
2024-04-11 02:42:13,903: ModuleNotFoundError: No module named 'musictheorypractice.settings'
Hi,
Please double check your configuration settings
@@CloudWithDjango thank you I got it fixed :)
No worries! Glad to hear that!
WIll this work for full stack website with django? with sqlite database?
Hi,
Yes, it should work fine, but for confirmation, I'd suggest testing it.
Its showing error while creating venv "no such file or directory: usr/bin/python"
Hi,
Please make sure that you have set up your project correctly and please double check your settings.
static files are not loading!
my website is loading only html
please help
Hi,
Please read the pinned comment for more information.
Thanks help me lot but what should I do for static files
No worries. Please refer to the pinned comment for information on static files.
Tnx sir 😊😊😊
My pleasure!
How to I reactivate the virtualenv that I've already created ?
Hi,
It would depend on your machine.
On Windows it will be something like:
my_env_name\Scripts\activate
On MacOS or Linux it should be something like:
. my_env_name/bin/activate
There are other ways, in which it can be done as well. So, you would need to research that, if the above doesn't work for you.
Good luck!
Hi, mine is not working, can you maybe help me? Would appreciate it very much
Hi Kirin,
No worries.
If you are struggling with PythonAnywhere, I'd recommend that you check out my other tutorial on deploying with Render.
Thank you.. this helped me... ive been looking for a django web host... i tried zeet and heroku but there is credit card involved...
Hi ilato!
Thank you for sharing your feedback, and deployment experience.
It is a pleasure! I'm very glad to hear that my video tutorial was of value to you :)
Another alternative would be Render or Railway.
Good luck!
Why isn't it loading my CSS styles? Help, please
Hi,
You need to use either white noise or amazon s3 for this. Please kindly refer to the pinned comment.
Hi the github is no longer available, is there anyway to reach to it?
Hi,
No, unfortunately not. As mentioned in the video, it is advised to use your own project.
To make things easier and as a suggestion, you can mirror the directory structure as observed in the video.
hi, I have a django project already on my local server so i want to host it online with namecheap do u have any video for it
Hi,
Sorry, no I do not.
0k, but it would have been really helpful @@CloudWithDjango
Thank you for the suggestion.
BRO HOW TO IMPORT CSS FILES ? I HAVE HTML AND CSS FILES IN THE WEBPAGE
Hi,
Please read the pinned comment for more information.
Please help me i'll getting Not Found The requested resource was not found on this server
Hi,
Please re-vist the steps, and double check everything.
thank you
My pleasure!
I'm getting an error with DJANGO_SETTINGS_MODULE. I've changed the default 'mysite.settings' to my project's name but it says ModuleNotFoundError. Please help
Check for the spelling and for the "__init__.py" files in your modules. Most of the time is one of these problems.
@@iuchh Thanks so much. I'll take a look
how to solve this bro
@@tadakiga6611 I didn't pursue with python anywhere, cause the option for custom domain was paid. I shifted to Heroku. Since, Heroku option was available, I didn't invest much time with the bug. I hope you can get through it though, let me know what you did for it
Please what do i do if i hav a requirements.txt do i pip install each and everyone? Please i want to know thx
Hi,
You can install all the packages in your requirements.txt with the necessary command or do it one by one.
@@CloudWithDjango thank you one more thing when I tried git clone the next line was telling me to put in an email and password I thought it was my git hub account details but that didn't work any ideas on how to solve that would be greatly appreciated.
In a django app there is an app name and a project name. In this case will you CD into the project folder or the app folder...
Hi,
We will always CD into the project folder. Never the app name.
Hey! I followed the tutorial and had no issue but when i click on the domain I get an error message:
Something went wrong :-(
Something went wrong while trying to load this website; please try again later.
If it is your site, you should check your logs to determine what the problem is.
I don't know what to do, if you could give some guidance, I would be very grateful!
Hi,
Thank you for reaching out, and for elaborating further. To be honest, I haven't tested this further with a domain name.
I'd recommend having a look at the below documentation, perhaps it gives you some insight:
help.pythonanywhere.com/pages/CustomDomains/
Also, please bear in mind that you will need to upgrade your website pricing plan eventually. Since, you will only have limited access to it on the free plan.
Good luck!
did you manage to solve?
thank for videos sir but i command git clone it ask me username of github and password password and username is true but it didnt use
Hi,
It's my pleasure.
Ah, this usually happens when your repository is private. You would then need to generate a personal access token from github... this token will serve as the password. The username will remain the same...
So, I'd recommend searching for info on generating a personal access token on Github... it should be straightforward
backend code worked but css design not working ......!!
help
Hi,
Please read the pinned comment for more information.
please help me i am getting a internal server error 500 when going to the page i followed the steps and rechecked multiple times there is no network logs as well
Hi,
If you have this message, it's quite possible that you have an error in your application. You can temporarily/very quickly set Debug=True to see the issue, fix the problem, and then quickly revert to Debug=False.
@@CloudWithDjangodude dont know how to thank u enough man the work you are doing is great i hope you always get what u want in life and be happy Thank you very much ❤❤
It is a great pleasure!
Thank you so much for your sincere and kind message!
All the best to you!
hello, wish you doing good .. my images in static folder didn't appear any idea why ?
Hi,
I'd recommend double checking your configuration
@@CloudWithDjango thanks, it works locally but not when i deployed i will see if there's an issue, thanks again
No worries. I'd suggest using Amazon S3 for your configuration and ensuring that you've configured it before deploying your application first.
I have used pandas and plotly in my project. So after the deployment the project is not running. Can anyone help me? How can I solve this
Hi,
As a good practice, I would suggest that you deploy a simple app with minimal packages first, and then work from there with larger applications.
@@CloudWithDjango I made a project where I had to plot some graphs. So I used pandas and plotly.
I used chatgpt and got a solution.
From the bash I went to the project folder and did pip install pandas and pip install plotly. Now my project is running.
I am very happy. Thank you so much. By watching this video I have done almost all the works.
Love you brother 😄
I'm glad that you are managing to work things out. No problem
What was inside of git hub...how it was created..?
Hi,
Only a simple project was created beforehand.
Im getting a file not found error while making a virtual environment...im using python 3.11 version
Hi,
I'd suggest ensuring that PythonAnywhere supports the django version that you are using first and then double checking your configuration carefully with the video.
@@CloudWithDjango ok I got it, but my python version is 3.12 how can I proceed with it...
Perhaps use Python 3.10 or 3.11 if pythonanythwere supports it. As in the video
It worked for python 3.11 version ?
Hi,
You would need to test it and take a look.
thanks
My pleasure!
but pictures which is in website not shown
Hi,
Please kindly refer to the pinned comment for further guidance on images
thankyou
My pleasure!
Can i store my mysql database here as well
Hi Denny,
Yes, that would be possible.
Here is some guidance on doing so:
www.javatpoint.com/how-to-connect-mysql-to-django
Good luck!
Thank you for the video. If you don't set the static and media file manually, it does not work, Also, my site would not run without secret key as well.
Hi,
My pleasure!
Yes, you would need to use Amazon S3 or white noise for static and media files. Yes, that would be expected to occur - you shouldn't remove your secret key. if you want to hide it during the deployment process then you will need to set up environment variables for security.
ty
My pleasure
Hey CWD, external database is not working. I have postgresql from Render.
Hi,
I would recommend double checking your database settings. It's the only thing that it can be.
@@CloudWithDjango I run it locally and external database is fine. Also I'm only using the free version of pythonanywhere.
Hi,
It might be best to use Native resources in this case. Meaning to deploy your application with Render, and use the database with Render only, and not to mix with PythonAnywhere.
my project size is 1.20 GB can it work on the free plan? also will the free plan always be free?
Hi,
The best way would be to test it, then you would know for sure.
No, unfortunately not. For all free plans out there, there will always be a usage limit.
@@CloudWithDjango thank you !
No worries :)
Does anyone know if they have added higher versions of Python ?
Hi,
Yes, PythonAnywhere does add higher versions as time goes. In order to see which versions are available, I'd suggest testing out the process with the video.
Thank you very much !
My pleasure!
can we upload database app like potgrsql to python anyware?
Hi,
Thank you for reaching out.
You should be able too, but I'd recommend making use of AWS RDS and generate a postgres database there. It's much easier and more beneficial
Good luck!
@@CloudWithDjango if yiu have tutorial or doc
@@csbina781 Yes, maybe this will help you.
th-cam.com/video/6iyD1uFc_Io/w-d-xo.html
All the best! :)
what about migrations
and sqlit3 database file
Hi,
You should be able to make your migrations in the terminal shown. SQlite will be included by default if your django project contains it.
Hi ı get 500 server error can you please help
Hi,
If you are struggling to deploy, I'd suggest that you either re-check your configuration settings and your application.
Great video mate, I just get "ModuleNotFoundError: No module named 'msilib'"
Thank you!
This error is in direct relation to your packages. Please ensure that you deploy your application with minimal packages on your first try, and then slowly build on.
I'd suggest double checking your packages and their versions. It's all to do with trial and error, I'm afraid!
Good luck!
Can i upload backend here?? And only frontend??
Hi,
The best way to check would be to try and deploy the way that you would like to deploy your project. You will then have your answer.
how to upload a file on git more than 25 mb
Hi,
In that situation, you can use the following alternatives:
- Use Git Large File Storage (LFS):
- Use a cloud storage service (Amazon S3 or Google Cloud Storage)
I am getting error as template doesn't exist
Hi,
Please ensure that your application is working correctly before you deploy it. In this case, please check your templates.
IT not working for me 😢
Error:- Unhandled Exception
Hi,
Please double check the steps and your configuration.
@@CloudWithDjangonow file in not showing 😢
what about the database part . can you make it clear
Hi,
By default Django already has an SQLite database integrated. There is nothing that you need to do.
@@CloudWithDjangoWhat if I have postgresql?
PostgreSQL will work. I'd suggest using Railway or Render to create a PostgreSQL instance.
It's not working in python 3.12😢
Hi. Python 3.11 and 3.12 are not yet available.