Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I wanna Django runserver on the background when I start my laptop I'm using ubuntu.
I tried using "screen" but this is not what am looking for.
For background runserver on OS startup, you can pick Gunicorn or Supervisord, or Uwsgi as process runner. These folks can run your project in auto mode, and if you make them as ubuntu services, they can boot up and run project after OS startup.
gunicorn
uwsgi
supervisord
Last link combines gunicorn with supervisord: Gunicorn will run project by command, and supervisord will be a process watcher for gunicorn.
Almost all links have receipt for configuring nginx, you may skip this step, because it's used for servers to proxy requests to your app's process. On laptop you may run project on localhost, it's just fine for debug or development.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
This is a beginner question. I post this here because I'm so lost that I realized I even don't know what to look for.
I'm a C++ developper and have a developed C++ app. On the other hand, I recently dug into web development and created a website using the Django framework, which I host on Heroku.
The flow of the website: a user enters input on the website, input files are uploaded to AWS S3 (I managed to get that working).
The part I'm lost: with the user input, I'd like to run the C++ app which I host on a Linux server (Codenvy). But I have no idea how to launch that application from the Django site which is served by Heroku. At least giving some keywords to enhance my web searches?
It sounds like what you need is to run a script on another server using python?
I'd suggest taking a look at Paramiko:
https://github.com/paramiko/paramiko/
It is a package to allow you to ssh into another machine and execute commands.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
My flask app uses threading packages to handle scheduled jobs(cron type).
It works fine when I use python hello.py but it doesn't work with Gunicorn gunicorn --bind 0.0.0.0:5000 wsgi:app
Can Gunicorn handle multithreaded app?
how can I configure it to handle my app?
here is my hello.py https://gist.github.com/prrraveen/fafb4e1de14d39c1e0e5454f3d322114
The function run_continuously() would never be called under gunicorn as it loads your code as a module and not as a main program as would occur if run as a script, thus __name__ will never be __main__.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I built an application on my local machine with Python and Django. Its working fine. Now, I would like to automate the process to start my Django application on a production server.
What I have to do to achieve that?
Django documentation don't recommend to use Django built-in server on production.
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone
through security audits or performance tests. (And that’s how it’s
gonna stay. We’re in the business of making Web frameworks, not Web
servers, so improving this server to be able to handle a production
environment is outside the scope of Django.)
It's recommended to use gunicorn or uWSGI to launch your WSGI application :
- How to use Django with gunicorn
- How to use Django with uWSGI
Another good practice, it's to use supervisord to start your process, Then if it dies or get killed for some reason, supervisord will restart this process.
And to finish, use nginx or apache as proxy server, which are strong server that can handle the charge. Most of tutorials or documentations, recommend to use nginx because it's a high-performance HTTP server.
NGINX is a free, open-source, high-performance HTTP server and reverse
proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its
high performance, stability, rich feature set, simple configuration,
and low resource consumption.
Check this to know how to configure them :
- Deploying Gunicorn with nginx
- Deploying uWSGI with nginx
Also before deploy your Django app, read this checklist, to make sure everything is well configured : Django - Deployment checklist
With this architecture and tools, you will be able to launch your gunicorn process with a simple supervisord command. That's all. Then gunicorn will launch your WSGI application.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have working simple blog. Code here - https://github.com/4doge/askMe
I already have account on pythonanywhere and Flask app. What i need now?
Specifically, what steps should I follow to get the code off github, onto pythonanywhere, and then make the blog site live on the Internet using pythonanywhere's service?
I think these would be the next steps to deploy the app:
open a console: go to pythonanywhere.com, click on Consoles and then on Bash
clone your app
git clone git#github.com:4doge/askMe.git
You go to pythonanywhere.com and click on Web
click on add a new web app. (delete the old one if you have a free plan and do not need the old one)
click through and in the last dialog step you can choose the path to your run.py
Now the app should be running. You can restart it and browse it.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I decided to move from PHP and start using Django. I have successfully installed Python and Django on my web server. How can I just code my Python/Django program, throw it to the server over FTP, and run it without the need to SSH to the server and restart the django server every time?
What is the method to run Django codes exactly the same way we run PHP code (having the server running all the time if possible)?
My server runs CentOS 5.8 and Apache.
Edit:
Alright I really recommend this tutorial for who ever want to setup dJango on a web server , my recommendation after reading a lot of posts. Using dJango on Nginx web server is the most powerful performance you could get
https://code.djangoproject.com/wiki/DjangoAndNginx
You can't magically make Django run like PHP. Please look at the deployment documentation, as it's some of the best around.
You'll see step by step instructions for apache.
As for not having to SSH every time you load new code, the best tool for this job is fabric.
http://docs.fabfile.org/en/1.5/
Fabric is an amazing tool that is extremely easy to install and configure, which lets you run commands on your remote machine from your local machine.
For example, I simply type fab production deploy on my local machine to...
push git changes
pull git changes on remote
run pip install
migrate database
run collectstatic
finally "restart" apache - touching wsgi file.
I just want to stress that fabric is not like those deployment build scripts which are complicated. Fabric will literally take you 10 minutes to set up.