Docker for deploying djano application [closed] - django

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have seen some pages with title deploy django with docker .
I deploy just with nginx & gunicorn and its awesome .
Is docker good for deploying django app ?
Does it make application faster or with better performance ?
So whats the main purpose ?

Docker helps developers bring their ideas to life by conquering the complexity of app development. It packages your Django app and creates a run time making sure that it works the same on all machines.
"But, It works on my system" - Developer without docker!
Also, you might be using nginx and gunicorn with Docker as well for hosting your django app. Containerization is a generic concept to have a machine independent run time to package everything. It simplifies your deployment process.

Related

EC2 reinstall ubuntu on amazon web service [closed]

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 5 years ago.
Improve this question
I have a ubuntu instance on AWS and I has installed some packages, and they make some errors.
Now I want clear everything and reinstall ubuntu.
Its easier to provision a new instance than re-use the same. If you have to stick with the instance then try removing/purging the packages you have installed. You can also run autoremove post removal of your packages to cleanup unwanted dependency which might have got installed.

How to install or configure Angular 2 app on AWS EC2? [closed]

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 6 years ago.
Improve this question
I have installed angular-cli and node in AWS EC2 server. After that i cloned my angular 2 app from Git repository i.e BitBucket to server. The problem is when i enter the ip address of my server in browser the app is not running. As angular 2 uses localhost:4200 if you are running locally but how to tell to server that which url need to use.
Wow, there are literally n number of ways to do this. You have to do exactly what you would do on your Mac's terminal. You just have an additional step of SSHing to your EC2 instance.
Open Mac Terminal.
SSH to your EC2 terminal.
Install node, npm there.
Clone angular 2's seed repository.
run npm install to install dependencies
run npm start to fire up dev server

Efficient webapp developing [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Is not efficient :).
I'm trying to learn django by building a simple app. I bought a hosting plan on webfaction, set up github account and a putty on my Windows machine. I'm writing the "code" on my Windows, pushing it to github repo, then connecting via putty to my webfaction account to pull from github.
This is extremely tedious and boring process and I can't help but wonder that I'm doing something wrong. Even fixing a simple typo takes a lot of time. Are developers writing everything server-side using vim? This sound even less encouraging. Can I do something to improve my workflow? How it's done by professionals?
To summarise Kit Sunde's answer: you shouldn't be deploying to the server until you've actually got a site to deploy. Normal development and testing is done locally, using manage.py runserver and a local db. This works fine on Windows.
You need to stop wasting your own time, which you are if you are editing code on the server. There are many reasons why you shouldn't deploy code that way the most important ones is that you'll waste time and also importantly is that you'll break things while users are looking at the site.
Setup a development server locally, this is why the django manage.py runserver exists. If you for some reason can't run it on windows, then install a server in virtualbox, mount the folder in windows where your code is and run it off that (this is what we do for our designers although we have a lot of dependencies).
There are IDE's out there that enables you to run Django via a GUI that you might find more comfortable, I use PyCharm and I hear good things about eclipse.
You'd save time if you learned how fabric worked so you can automate your deploy process. I am unsure how well fabric works on windows, but I'm sure you can use cygwin or similar to get it working.
A fairly basic example would be this one:
from fabric.api import *
env.hosts = ['ubuntu#example.org']
def deploy():
pid_file = "~/myproject/process.pid"
with cd('~/myproject/'):
run('git pull')
run('src/city_nomads/manage.py collectstatic --noinput')
# If the process isn't up we don't want the thing to exit.
with settings(warn_only=True):
run("cat {} | xargs kill -TERM".format(pid_file))
run("src/myproject/manage.py runfcgi "
"method=threaded "
"host=127.0.0.1 "
"port=8000 "
"pidfile={} "
"--settings=myproject.settings_release".format(pid_file))
It'll SSH into my server, pull the source, collectstatic, kill the process if it's there and then run django as fastcgi. I'm assuming you have nginx or apache set up to connect to Django on port 8000.

Celery slowing down django [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have a django 1.3 site using SQLite. It works well.
I recently install django-celery along with django-kombu. I am using supervisord to launch the celery dameon with the command:
python manage.py celeryd -v 2 -B -s celery -E
Everything works, except launching celeryd brings the system to a crawl. When I use top, I see that I am creating a long running python process that consumes anywhere from 5% to 10% of the cpu on my shared server.
During testing, I have no celery tasks scheduled or running.
From my experience, it's django-kombu that's taking a lot of CPU time. Use another broker like RabbitMQ or Redis.

how do I deploy Django on AWS? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking to deploy a django app on AWS (since I have some credit coupon) and am looking for a good place to read about it - mostly b/c I never used it before. thanks
looking for a good place to read about it
Here you go
I am a developer at BitNami, you may want to take a look at our free Django AMI. It is compatible with the AWS free tier.
2 new tutorials are given
realpython doc
and
Ashok Fernandez blog
The simplest approach is to simply spin up an EC2 instance, install nginx (mysql? and any other dependencies you might have) then follow the steps on the django site: https://code.djangoproject.com/wiki/DjangoAndNginx to deploying it. This basically goes through setting up a script to run "python [your app directory]/manage.py runfcgi host=127.0.0.1 port=8080" and setting up nginx to proxy requests to that port.
Another approach is to simply use a 3rd party tool like http://nudow.com to automate the deployment. For now the initial deployment I believe has to be done manually, however subsequent deployments can be done with one click. (and has other benefits like versioning)
I usually use Nginx on an EC2 instance
If you wish to deploy your Django app ASAP, without scratching your head :
You can use this script that I wrote:
Safely deploy your Django app in less 1 minute!
Instructions
Installing the DeployDjango script
$ wget https://raw.githubusercontent.com/yask123/DeployDjango/master/deploydjango.sh && chmod +x deploydjango.sh
From your Django App’s root directory (Where manage.py file exists).
$ sudo ./deploydjango.sh project_name
Done!
Visit http://ip-address-of-your-instance to see your web app live!