drksephy / django-hackathon-starter Goto Github PK
View Code? Open in Web Editor NEWA boilerplate for Django web applications
A boilerplate for Django web applications
Hi,
I think you should add a landing/homepage. For one thing, it's counter-intuitive to start a project on a local server and have an error where index.html would usually be, though I see that you have already used index.html in the app. Could do something like this at a project level in hackathon-starter/urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='homepage.html'), name="homepage"),
url(r'^hackathon/', include('hackathon.urls')),
url(r'^admin/', include(admin.site.urls)),
# url(r'^openid/(.*)', SessionConsumer()),
)
And add templates (with homepage.html) and static directories:
hackathon-starter/
manage.py
hackathon-starter/
__init__.py
settings.py
urls.py
wsgi.py
hackathon/
app-level-files
static/
templates/
homepage.html
Of course the homepage.html would provide a link to (/hackathon) index.html. What do you think?
Hello,
I have followed every step and deployed this in a vagrant VM configured with puphpet.
The machine is running apache in Ubuntu, how do I enable the site and log into this default config
Thanks,
Adam
This project is an awesome project starter. Thanks!
But one thing caught my eye: there's only one configuration file for all possible envs: development
, stage
, testing
, production
and local
.
Maybe it would be a good idea to add some kind of library to handle that? Some popular examples: django-configurations
and django-split-settings
.
Also, adding a lot of social providers inside the same settings file may grow it long and nasty.
Here's a brief example, how to use django-split-settings
. We will need new settings
package structure:
your_project/settings/
├── __init__.py
├── components
│ ├── __init__.py
│ ├── database.py
│ ├── common.py
└── environments
├── __init__.py
├── development.py
├── local.py.template
├── production.py
└── testing.py
And here's settings/__init__.py
:
"""
This is a django-split-settings main file.
For more information read this:
https://github.com/sobolevn/django-split-settings
Default environment is `production`.
To change settings file:
`DJANGO_ENV=testing python manage.py runserver`
"""
from os import environ
from split_settings.tools import optional, include
ENV = environ.get('DJANGO_ENV') or 'production' # since it's a production-ready template
base_settings = [
'components/common.py', # standard django settings
'components/database.py', # database setup
# Select the right env:
'environments/%s.py' % ENV,
# Optionally override some settings:
optional('environments/local.py'),
]
# Include settings:
include(*base_settings)
So after that it would be crystal-clear for users where to put extra configurations like: django-debug-toolbar
and other which are used for development or testing only.
Pros:
Cons:
Maybe I am missing any cons, please correct me if I am wrong.
Here's a detailed article I wrote on this topic: https://medium.com/wemake-services/managing-djangos-settings-e2b7f496120d
So, what do you think? I will send a PR if that's fine.
Any 2.0 compatible forks being worked on?
A command-line based feature generator would help developers pick and choose the features they'd like to have in the base Django application, i.e: Twitter OAuth, Github OAuth, etc.
Docker is pretty common now, we could add docker support.
Since we have Github, it would be good to have it's complement (Bitbucket) in our login and examples page. You can find more about Bitbucket OAuth here.
When I am using Django 1.11 it gives error - 'No module named creation'.
Does this starter kit support Django 1.11 ? IMHO support for Django 1.11 must be there, as it is going to be supported for a long time.
It would be useful to implement a Venmo API example. To begin, we need to implement Authentication using the OAuth 2.0 workflow, which can be found here.
One of the most common sign-in methods (Facebook) has not been implemented. Users often fall back to using this method, so it should be a high priority to get it done.
Due to the older Facebook example being removed, I am no longer sure if those steps are correct. Would it be possible to update these steps?
Currently, some API examples require the user to be specifically authenticated to a particular service. For example, the Facebook
example will not work if the user is authenticated with Google+
. We should have a method that will redirect the user to be authenticated for the proper API method (i.e, if the user is currently logged in through Facebook and wants to use the Dropbox API, we should re-direct the user to be authenticated through Dropbox). This should be done for all the API examples that require authentication.
Also for the examples done by @mk200789, I propose we change the re-direct url structure like this:
http://localhost:8000/hackathon/
. Instead, we should then redirect the user to the API example they requested to view (Twitter in this case). An implementation to do is:
http://localhost:8000/hackathon/oauthcallback/twitter
. On this view function, we now redirect the user to the Twitter example they requested to use.Dropbox
would have a redirect_uri
of http://localhost:8000/hackathon/oauthcallback/dropbox
, and would properly re-direct the user to the API example. This is perhaps a solution to the first problem on top, where if the user isn't authenticated with the right service, we re-direct them to be authenticated, then bring them back to the API they requested to view.Questions and comments are welcome. This would greatly improve the user flow, as right now it requires the user to log out and log back in with the proper method, and would remove having the user go back to the main page after authenticating for an API examples (as shown by the Twitter example).
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 351, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 325, in execute
django.setup()
File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 86, in create
module = import_module(entry)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'bootstrapform'
during the pip install -r requirements.txt I have the following message
Collecting nose==1.3.4 (from -r requirements.txt (line 23))
Downloading nose-1.3.4-py3-none-any.whl (154kB)
100% |████████████████████████████████| 155kB 474kB/s
Collecting oauth2==1.5.211 (from -r requirements.txt (line 24))
Downloading oauth2-1.5.211.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 20, in
File "/tmp/pip-build-a8l23vkw/oauth2/setup.py", line 18
print "unable to find version in %s" % (VERSIONFILE,) ^
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-a8l23vkw/oauth2
I tried with django 1.7 and 1.8 virtual environments with python3
has anyone else met the same issue ?
Thanks in advance
I got a number of errors in following your instructions. It may help to explain what settings to use in the virtualenvironment, for example the python version. I have to use sudo to install the requirements without getting errors get errors such as:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-che3oe8o/unroll/
And then trying to run the make migrations I get the error:
Traceback (most recent call last):
File "manage.py", line 8, in
from django.core.management import execute_from_command_line
ImportError: No module named 'django'
it would be cool to add oauth authentication to access rest interface of the hackathon server
Hi, I just saw your project and wanted to share this link with you in case you haven't noticed:
https://github.com/audreyr/cookiecutter
So could consider turning this project into a cookiecutter template.
Good luck in any case!
Another popular API is Foursquare. A login feature as well as a basic user information example would be useful to have. For more information on authenticating a user, read here.
I have spent hours trying to get the user email after login, but the response object from facebook api script would only return the user's name and id. Anyone know how? Thanks.
I think it would be awesome to install travis.ci in this repository for testing purposes, don't you think?
To make use of Google's numerous APIs, Google+ authentication is needed. More information on this can be found here.
Have not yet quite figured out how to contribute using git (as my profile probably shows!) but in case anyone needs it I ported the app to Python 3.4 (tested with django 1.8.4).
https://github.com/kabaka0/django-hackathon-starter
Sorry for using 'Issues', I assume it is not the right forum for this.
One unittest fails though, testGetForkedRepositories(). I currently have it set as skipped. I assume that 'DrkSephy's repositories have changed hence the failure.
Currently there is a simple Django Rest framework example for creating Code Snippets and sending a JSON response to the server. It would be good to have a deeper example which supports more features beyond GET requests (PUT, DELETE, UPDATE).
Looks like after authenticating nothing is saved and user is returned to the api page.
Athough /hackathon/githubResume/
and /hackathon/githubUser/
work properly on my resh install on a brand new virtualenv, /hackathon/githubTopRepositories/
fails.
Here is my stacktrace :
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/hackathon/githubTopRepositories/
Django Version: 1.7.6
Python Version: 2.7.12
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'hackathon',
'bootstrapform',
'django_nose',
'rest_framework',
'corsheaders')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/home/edelans/.virtualenvs/django-starter/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/edelans/github/django-hackathon-starter/hackathon_starter/hackathon/views.py" in githubTopRepositories
532. list = getTopContributedRepositories(user, repositories, settings.GITHUB_CLIENT_ID, settings.GITHUB_CLIENT_SECRET)
File "/home/edelans/github/django-hackathon-starter/hackathon_starter/hackathon/scripts/github.py" in getTopContributedRepositories
260. jsonList.append(json.loads(req.content))
File "/home/edelans/.virtualenvs/django-starter/local/lib/python2.7/site-packages/simplejson/__init__.py" in loads
505. return _default_decoder.decode(s)
File "/home/edelans/.virtualenvs/django-starter/local/lib/python2.7/site-packages/simplejson/decoder.py" in decode
370. obj, end = self.raw_decode(s)
File "/home/edelans/.virtualenvs/django-starter/local/lib/python2.7/site-packages/simplejson/decoder.py" in raw_decode
400. return self.scan_once(s, idx=_w(s, idx).end())
Exception Type: JSONDecodeError at /hackathon/githubTopRepositories/
Exception Value: Expecting value: line 1 column 1 (char 0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.