GithubHelp home page GithubHelp logo

deploydjango's Introduction

DeployDjango

Safely deploy your Django app in less 1 minute!

Got a cool Django web app running in your local machine? Wish to take it to the world ASAP, without scratching your head ?

Usage Just run this bash script from the root of your django project in your Ubuntu instance.

$ sudo ./deploydjango projectname

###That’s it, You’r done!

Visit http://ip-address-of-your-instance to see your web app live!

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).

./deploydjango.sh project_name

Notes:

  1. Script works for Ubuntu instance only!
  2. Make sure port 80 is open (For your app to be accessible to users after deployment) 

Behind the scene

The script would run your django app with gunicorn on port 8000, and would use nginx reverse proxy settings to make your app accessible from port 80. 

The script does the following things:
  • Install nginx,python-pip, gunicorn.
  • Set up the correct nginx configuration for your django app
  • Start nginx service on your instance
  • Start your app with gunicorn
  • Perform tests to verify if deployment was successful (ToDo)

deploydjango's People

Contributors

yask123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploydjango's Issues

How to install gunicorn for python3 ?

image
Hi, Yask,
Thank you for the app. It works cool

As I was using this, it always install gunicorn to Python2.X. I am actually using 3.6.

Is there a way we indicate a special environment to install the gunicorn ?

Cheers

cannot open the application

I tried exactly the same as the README.md says and deployed my application on a ubuntu AWS EC2 instance. When I ran the script, it seems that gunicorn has started my application,

ubuntu@ip-172-31-44-194:~/team6412-S18/phase1$ sudo ./deploydjango.sh phase1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nginx is already the newest version (1.10.3-0ubuntu0.16.04.2).
0 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
wget is already the newest version (1.17.1-1ubuntu1.3).
0 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: gunicorn in /usr/local/lib/python3.5/dist-packages
--2018-03-19 22:59:29--  https://raw.githubusercontent.com/yask123/nginx-conf/master/nginx.conf
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.200.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.200.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1570 (1.5K) [text/plain]
Saving to: ‘nginx.conf’

nginx.conf                       100%[==========================================================>]   1.53K  --.-KB/s    in 0s      

2018-03-19 22:59:29 (362 MB/s) - ‘nginx.conf’ saved [1570/1570]

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

You have requested to collect static files at the destination
location as specified in your settings.

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
    collected = self.collect()
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
    handler(path, prefixed_path, storage)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 344, in copy_file
    if not self.delete_file(path, prefixed_path, source_storage):
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 250, in delete_file
    if self.storage.exists(prefixed_path):
  File "/usr/local/lib/python3.5/dist-packages/django/core/files/storage.py", line 308, in exists
    return os.path.exists(self.path(name))
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/staticfiles/storage.py", line 43, in path
    raise ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
[2018-03-19 22:59:31 +0000] [9524] [INFO] Starting gunicorn 19.7.1
[2018-03-19 22:59:31 +0000] [9524] [INFO] Listening at: http://127.0.0.1:8000 (9524)
[2018-03-19 22:59:31 +0000] [9524] [INFO] Using worker: sync
[2018-03-19 22:59:31 +0000] [9527] [INFO] Booting worker with pid: 9527

But when I go to the browser and type in my instance public dns, I cannot connect to it. Could you please give me some hints on this? Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.