How should I upload a Django project to GitHub? - django

This is probably a very dumb question. But I have a little project in Django and I would like to upload it to GitHub to just have it there.
I know how GitHub works and I know how to upload the project. But I'm wondering if just uploading the whole folder is the right way to do it.
I mean. I have a data base with my project, that has some information.
So is the database JUST in my computer right? It won't get uploaded next to the project to github?
So basically I'm asking:
Should I just simply upload the whole folder?
And if I were to download my project from GitHub from another computer. Should I just have to run migrations to make it work locally?

Don't push your settings.py into a repository, because it has some important information about your application such as SECRET_KEY OR DATABASE.
It’s important to keep your application credentials like API Keys, Amazon S3, email parameters, database parameters safe, specially if it’s an open source repository.
You need to make sure that these kind of information will be stored in a secure place and don't push it into a public repository.
There are more files that you shouldn't push into your repository. check out this link to know more about .gitignore files in Django projects. also there is a website that you can create your .gitignore files automatically.
Now if you want to know more about how to store these kind of informations you can use environment variables and also there is a package called python-decouple that you can use it for storing your important informations.

Related

Whats a good pattern for a web-application for serving files?

I am working on an angular Web-Application where it's possible to view pdf-files in a pdf-viewer in the browser.
The Web-Application is also consuming a REST-Service in Django.
In the Database the information of the pdf-files is stored. The Web-App is calling the REST-API to check where the files are stored.
As I am still in the Proof-Of-Concept Phase of the project, the PDF-Files are currently stored in the assets folder of the angular web, which of course is not what I want in the end.
When the Files or the Directories change, the Database should be updated automatically (or via a trigger in the app).
I have two questions:
Is there an obvious way to serve the files in this combination? i.e. an apache server? I imagine there are built in solutions in dedicated file servers to detect changes of the watched directory.
For a partly solution would it be reasonable to write a script on the django site, which does the file-serving, the updating and also providing the REST-API?

Azure Deployment not picking up SSL certificates in repo

I'm currently running a Django app on the Azure server. I have a MySQL database to access using SSL. The SSL certificates I need to access the server are physically in the repo and I got my Django settings file to point to these using a relative path.
I have Azure set up to do continuous deployment from BitBucket. Problem is, at the end of the deployment, it will copy over all the files EXCEPT for the .pem files that I need.
I have to manually copy over the certificates everytime I push a commit. The files are in static/certs/*.pem
Is there something wrong with Azure? Or BitBucket? Or is there a better way of doing this?
I figured it out. Anything put manually inside the static folder gets cleaned out by Azure during deployment.
Just don't put anything inside the static folder

Set up an existing Django app on another server

This must, must, must be a duplicate but I can't find the answer either here or on Google.
I have an existing Django app and I want to deploy it on another server.
What are the steps I need to go through to get it running elsewhere, in words of one syllable?
At a minimum, presumably:
create a project on the new server
copy over all my app's files into that project
edit localsettings.py or equivalent with local database settings etc
run python manage.py syncdb to create my database
load fixtures
run tests
Is that it? Are there any unofficial or official instructions for copying an app elsewhere?
Thanks.
The most basic, easy way to do it is:
Set up the server environment so that it matches the current environment as closely as possible. The most important thing is that you're using the same version of Django (obviously). You can run a different database, but it makes porting from the old server to the new server a little more involved. Otherwise, you will just have to adjust your settings to match the new server, if they can't be duplicated (ie, user names, etc).
Copy over your code
Dump your old database structure and data into the new database
Running startproject isn't strictly necessary. Your web server just needs to be configured correctly, to run django with the appropriate settings.py file -- and Django takes it from there.

Single sign on with confluence wiki

I would like to use our current intranet as the main application to authenticate users. Confluence should be able to ready the cookie I created from the intranet to authenticate the user automatically without prompting them for a username/password. I read a bit about seraph here: http://docs.atlassian.com/atlassian-seraph/latest/sso.html, however I am not really sure how to get started. I downloaded the zip and created the config files. However once I have created the classes in which folder do I place them and how do I actually compile them? I am new to Java.
I would prefer not use Crowd, since its very expensive and if we can build the SSO on our own, then we can save a lot of money.
Any help is appreciated.
I am using 3.1.1 on Windows.
The simplest way to integrate is to copy + modify the CAS client, linked from the page above. If you're completely new to Java, there's a bit of a learning curve - you need to create a JAR file which you copy into the $CONF_HOME/confluence/WEB-INF/lib directory, along with modifying your seraph-config.xml.
I'm not sure I can give you a complete tutorial on how to build a JAR file here, but the CAS client uses Ant, so if that's what you're modifying, install Java and Ant and run "ant build.xml" in the directory.
Hope that makes some sort of sense :-)

Free SVN repo server without requiring a project

I want to know if there are any free Subversion repository hosting servers where you don't need to have a 'project' to host your C++ files in.
I don't have a actual project, but I want to store my C++ in an SVN repository. I am looking for something like OpenSVN where you can upload your C++ files, but it requires you to have a project.
Can you recommend a Subversion hosting service where you can upload your files to an account, rather than a project. Something like: http://www.test-svn.com/~nathanpc/
Have you tried Assembla? It's free and you don't need to have a project.