django digital ocean git - django

I have set up my python, virtualenv, django environment in my digital ocean Ubuntu droplet. I have also set up SSH access to be able to deploy using git. I have set a remote url, so to push I just use "git remote live master". I have used git webhooks to push remotely. Since I used git init --bare for my remote repo, I cannot see the source code, I just see the hooks folders, etc.
The only issue is after pushing to the remote repository, how do I connect that repository to my django environment so that I can run it, access those source codes, so that I can do "python manage.py runserver"? I am a beginner to webhosting automatic deployment using git and django, I do appreciate your help.

Related

Updating code on Digital Ocean via GitHub

I have a Django app on Digital Ocean https://chicagocreativesnetwork.com/ which was uploaded via GitHub.
I need to make some changes to the CSS and HTML for this app, which I am doing locally and pushing to my GitHub repository.
How do I get the pushed GitHub updates into my Digital Ocean app?
How was the app uploaded to your Digital Ocean droplet exactly? Was the repo cloned or forked to the droplet?
Read the Caution at the end first
You could always go into your droplet console move to the directory where your project is in. Then do:
git status (to see the state of your repo)
then do git fetch (to fetch the changes from your origin to your droplet repo)
do a git status again (to see how many steps your droplet is behind your remote
repo)
if you see everything is ok and it says you are '1 commit behind master'(if you are changing for the first time after deployment)
Go ahead and git pull (with github username and personal access token as password)
do a final git status it should now say 'you are up-to date with remote'
CAUTION - do not git push anything from your droplet console into your remote repo even if git status shows files ready to be staged and committed in red.
These files are local to the droplet repo and should stay as they are. Any change you make should come from -
Local changes pushed to your remote repository
Going into your droplet console and Pulling the changes into your droplet repository
The workflow is detailed more clearly in the following comment:
https://stackoverflow.com/a/42001608/2155469

Deploying Flask app using Dokku

I have a Flask app deployed using dokku and now I want to modify the code and redeploy it. All the documents I found online says that I need to add git remote using below command
git remote add dokku dokku#mydomain.com:test
git push dokku master
Do i need to specify the domain.com:test as the domain name of my Flask application or it should be the git repo?
We need to add remote as below and then push the changes.
git remote add dokku dokku#<IP of server where app is hosted>:<App Domain Name>
Then verify remote is added using git remote -v
git push dokku master -- to publish the change

Deploy Django App on Azure: only displays default app, even after deployment

I am trying to deploy a webapp to Azure. I am following these directions https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/
First step, I created a webapp (Django) on the portal.
Then it says to follow the directions to configure Continuous deployment using GIT in Azure App Service. This should apparently lead to my having a local directory of Django files. https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
So I follow those directions, installing Git, creating a local repository, adding a webpage, enabling web app repository, deploying.
The webportal now shows that I have deployed ('active' deployment). However, when I go to the web app url, what's showing is NOT what I deployed, but rather what I guess is the default Django app with its urls (login, logout, contacts).
So then I create an actual Django app in my local directory (instead of the static index.html from the directions). I commit and push it to Azure. It shows as being deployed.
The result is the same as before: the default web app is showing.
So what I'm missing is the connection between my local repository and what's actually showing. Is there some way to pull the Azure default app into my local repository? (Once it's there, I'll be able to change it as I see fit.)
Things are working as expected, but you ended up overwriting the Django app in your first the Git commit. The Continuous Deployment instructions as written are generic to any deployment, even a blank Web App.
So what I'm missing is the connection between my local repository and what's actually showing. Is there some way to pull the Azure default app into my local repository? (Once it's there, I'll be able to change it as I see fit.)
All you need to do is git clone your repo after you've initialized your local Git repo on the Azure Web App. You've already gone through most of these steps, but I'll include them here for others who may be looking for this answer.
After you create the Django Web App from the Azure Marketplace/Gallery, scroll down to set up continuous deployment.
Choose Local Git repo.
Notice that you now have a Git Clone URL in both your Quickstart Essentials info and under All Settings >> Properties. Go ahead and copy this URL.
If you haven't already done so, you may need to set or reset your Deployment Credentials. You'll find this under All Settings. This will be your Git & FTP credentials. Note that this is actually the credentials for your Microsoft Account, not just this one Web App.
You already have Git installed from your first attempt. You should now be able to navigate to the folder you want to clone the repo into and run:
git clone <your_git_clone_url>
After you type in your password, you'll have a cloned repo of the Django Web App on your local system. cd into the directory and start working from there. Once you have changes, git add ., git commit, and git push them back to the repo in Azure to see your changes there.

How should I stage my bitbucket + heroku django app for development and deployment?

How should I stage my bitbucket + heroku django app for development and deployment?
I'm working on a Django App.
I don't want to use github because I want to host have a private repo.
So right now I know how to deploy an app on heroku but how do I do it through bitbucket?
What is this deployment key stuff?
Do I have to reset my git remote origins or something?
Do I deploy with different folders? and commit my source code to different folders?
What happens when I want scale up my development environment to multiple computers?
I know I will be using git to monitor changes to the repo, how should I allow all of them to deploy to heroku?
Thanks
Change your git remote to point to your bitbucket URL, then proceed as normal.
Your remote origin would be the URL to your bitbucket found in settings. Your remote heroku would be pointing to Heroku.
#dan-hoerst's answer is still correct but I wanted to draw attention to heroku's new pipeline feature which lets you handle your staging and production environment better way.
A pipeline is a group of Heroku apps that share the same codebase.
Apps in a pipeline are grouped into “review”, “development”,
“staging”, and “production” stages representing different deployment
steps in a continuous delivery workflow.
You can find more about it here https://devcenter.heroku.com/articles/pipelines

Two Heroku Apps for the Same Project?

I currently have a django project deployed on Heroku, but I would like to deploy another dummy Heroku app for testing purposes. The idea is that I can make changes to the dummy Heroku account on a git branch, see how it works live, and then merge and push to my actual Heroku project. Is this possible?
I haven't tried this but I don't see why it wouldn't be possible.
Just add another remote on git to the repository to your production heroku git address.
git remote add htest your_test_app_heroku.git
git remote add heroku your_actual_app_heroku.git