Re: Bizarre URL behaviour after deploying

2017-08-30 Thread Bernd Wechner

Mohammad,

> you have to use app_name in url.py in each app

I think you have misunderstood or misread my issue below. Clearly I do 
not have to use app_name in url.py, because I don't and it works fine. 
The problem is the complete inverse, namely I have not asked for the 
app_name to appear in the URL, and it does not appear in the URL with 
the development server (manage.py runserver)  and suddenly when deployed 
under lighttpd and uwsgi Django inserts the app_name into the URL 
without my ever having asked it to!


I want that to go away, I don't want an app_name in my URLs as I have a 
single app project so to speak.


Here are two people wanting to do the same (remove that from URL):

https://stackoverflow.com/questions/40322042/remove-django-app-name-from-path-with-custom-domain-heroku
https://stackoverflow.com/questions/18764967/django-admin-removing-app-name-from-url-for-single-app-projects

except none of the answers apply to my situation, because I have not 
ever defined app_name and it has never appeared in URLS so far (when 
running under  development). They only appeared, out of the blue, when 
deploying.


The whole project is here:

   https://github.com/bernd-wechner/CoGs
   

and I want to lose app name form my URLs (and ideally understand why 
they are there to begin with) not add them!


Kind regards,

Bernd

mohammad k wrote:

you have Different app in your project yes ?
you have to use app_name in url.py in each app

like that :
app_name = 'polls' in polls folder and in url.py

from django.conf.urls import url
from . import views

app_name = 'polls'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P[0-9]+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P[0-9]+)/results/$', views.ResultView.as_view(), 
name='results'),

url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
]

you have to create a url.py for each app in them folder

and in url.py beside settings.py use code like that 
:url('^polls/',include('polls.urls')),


On Wed, Aug 30, 2017 at 4:11 PM, Bernd Wechner 
> wrote:


This has bamboozled me some. And the best thing I've found on-line
doesn't seem to apply:


https://stackoverflow.com/questions/26944908/django-url-mapping-how-to-remove-app-name-from-url-paths



Let me summarise.

I have a site that I've been building and testing with djangos
development server of course. And it implements URLS like:

http://127.0.0.1:8000/list/Model 
http://127.0.0.1:8000/add/Model 
http://127.0.0.1:8000/edit/Model/nn

http://127.0.0.1:8000/view/Model/nn

http://127.0.0.1:8000/delete/Model/nn


Works like a dream, so I'm deploying, locally first, under
lighttpd and uwsgi. That is working fine too. Sort of,

These are all reached with links in my templates like yo:

{% url 'list' model %}
{% url 'add' model %}
{% url 'edit' model pk %}
{% url 'view' model pk %}
{% url 'delete' model pk %}

because in urls.py they all have "name"s defined like that.

All honky dory.

Now after deploying everything works nicely, but those same links
point to:

http://mysite.tld/app/list/Model 
http://mysite.tld/app/add/Model 
http://mysite.tld/app/edit/Model/nn

http://mysite.tld/app/view/Model/nn

http://mysite.tld/app/delete/Model/nn


That is the app name is inserted. Odd. And undesired if not a crisis.

But here's what bamboozles me. I can replace "app" in the url with
any string at all, "x" say and the site continues to work but
those URLs now point to :

http://mysite.tld/x/list/Model
http://mysite.tld/x/add/Model
http://mysite.tld/x/edit/Model/nn 
http://mysite.tld/x/view/Model/nn 
http://mysite.tld/x/delete/Model/nn


For what it's worth I don't want to quote urls.py and every other
bit of possible config here of course, I am mainly interested to
know if someone has insights that aren't shared in that SO link
above as none of what is shared there seems to apply.

For anyone really keen on code explorations urls.py is here:

https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py


and the 

Re: Bizarre URL behaviour after deploying

2017-08-30 Thread Bernd Wechner

Daniel,

Yes, I have deployed, that is the problem in a sense. URLs are clean in 
dev and suddenly contain an app_name when deployed.


Not sure what you mean by configuration? The Django settings are here:

https://github.com/bernd-wechner/CoGs/blob/master/CoGs/settings.py

The rest of the config is uwsgi under lighttpd, but none of that is 
likely to impact the appearance of an app_name in my URLs all of a 
sudden. I don't mind sharing the config files, but it's a distraction I 
fear. As the site runs fine, only the URLs are modified by Django post 
deployment for some reason.


I have found more folk wanting same and yet none of the posted solution 
are useful to me:


https://stackoverflow.com/questions/40322042/remove-django-app-name-from-path-with-custom-domain-heroku
https://stackoverflow.com/questions/18764967/django-admin-removing-app-name-from-url-for-single-app-projects

as my puzzle is why the app name is used post deployment but not in 
development. I have nowhere asked for it to be used and am not making 
sense of why it is being used alas.


Kind regards,

Bernd.

Daniel Roseman wrote:

How have you deployed this project? Can you show your deployment 
configuration?

On Wednesday, 30 August 2017 12:42:01 UTC+1, Bernd Wechner wrote:

This has bamboozled me some. And the best thing I've found on-line
doesn't seem to apply:


https://stackoverflow.com/questions/26944908/django-url-mapping-how-to-remove-app-name-from-url-paths



Let me summarise.

I have a site that I've been building and testing with djangos
development server of course. And it implements URLS like:

http://127.0.0.1:8000/list/Model 
http://127.0.0.1:8000/add/Model 
http://127.0.0.1:8000/edit/Model/nn

http://127.0.0.1:8000/view/Model/nn

http://127.0.0.1:8000/delete/Model/nn


Works like a dream, so I'm deploying, locally first, under
lighttpd and uwsgi. That is working fine too. Sort of,

These are all reached with links in my templates like yo:

{% url 'list' model %}
{% url 'add' model %}
{% url 'edit' model pk %}
{% url 'view' model pk %}
{% url 'delete' model pk %}

because in urls.py they all have "name"s defined like that.

All honky dory.

Now after deploying everything works nicely, but those same links
point to:

http://mysite.tld/app/list/Model 
http://mysite.tld/app/add/Model 
http://mysite.tld/app/edit/Model/nn

http://mysite.tld/app/view/Model/nn

http://mysite.tld/app/delete/Model/nn


That is the app name is inserted. Odd. And undesired if not a crisis.

But here's what bamboozles me. I can replace "app" in the url with
any string at all, "x" say and the site continues to work but
those URLs now point to :

http://mysite.tld/x/list/Model
http://mysite.tld/x/add/Model
http://mysite.tld/x/edit/Model/nn 
http://mysite.tld/x/view/Model/nn 
http://mysite.tld/x/delete/Model/nn


For what it's worth I don't want to quote urls.py and every other
bit of possible config here of course, I am mainly interested to
know if someone has insights that aren't shared in that SO link
above as none of what is shared there seems to apply.

For anyone really keen on code explorations urls.py is here:

https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py


and the whole site is there too.

What I want to understand is why this "app" suddenly appears in my
URLs and how I can control it (remove it ideally). But I have
looked at urls.py long enough and scratched my head and not found
it. settings.py is right next to if you need to inspect it.

Kind regards,

Bernd.




--
DR.
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8142e4c2-8a1b-4e6a-8bea-7f39416b1e61%40googlegroups.com 

Re: Deploying Oracle database to production enviroment

2017-08-30 Thread Alceu Rodrigues de Freitas Junior
Heh... why make things easier when we can complicate? 

Instead of bringing your problem to you, you could push back on to them:
ask them to have a "stage" schema (where you do have permission to change)
they would just export later to the production environment.

If they want audit, the database surely provide that for them.

Another option is leaving them running the migration themselves... they can
provide the proper authentication then.

On Wed, Aug 30, 2017 at 7:09 PM, Eduardo Velazquez 
wrote:

> Hi,
>
> I've been working with django within the place I work and in order to
> deploy the django app we're developing we need to migrate the database to a
> production enviroment.
> The database backend we are using is Oracle, and the users permission
> created for that are just for select, insert, etc, not for setting the
> database.. the Database Management department are requesting for the raw
> sql so that they can create the tables for just the django app uses it.
>
> So, my question is... if I export all the sql from the migrations one by
> one it is possible that the django application runs fine? or is there a way
> to export all the sql code necessary to run the application and not to run
> the manage.py migrate command?
>
>
> Thanks!!
>
> Eduardo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/8aa80602-ce4c-49ed-a1f9-e2da4a8d971e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKxtECpL4fndfmBwwrTgKbub-9yfLEH%3Dk5-XrdDgsnjh68RHvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Deploying Oracle database to production enviroment

2017-08-30 Thread Eduardo Velazquez
Hi,

I've been working with django within the place I work and in order to 
deploy the django app we're developing we need to migrate the database to a 
production enviroment.
The database backend we are using is Oracle, and the users permission 
created for that are just for select, insert, etc, not for setting the 
database.. the Database Management department are requesting for the raw 
sql so that they can create the tables for just the django app uses it.

So, my question is... if I export all the sql from the migrations one by 
one it is possible that the django application runs fine? or is there a way 
to export all the sql code necessary to run the application and not to run 
the manage.py migrate command?


Thanks!!

Eduardo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8aa80602-ce4c-49ed-a1f9-e2da4a8d971e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you interact with the Django test database outside of tests?

2017-08-30 Thread Kurt Wheeler
I've figured it out! I was running my end-to-end tests in a class which 
inherited from TestCase. This cause all the database calls for that entire 
class to be run within a transaction, so I couldn't see the changes because 
the transaction was never allowed to finish. By switching the base class to 
TransactionTestCase, I was able to prevent this behavior.

On Friday, August 25, 2017 at 5:25:03 PM UTC-4, Kurt Wheeler wrote:
>
> I am attempting to write end-to-end tests for my system. To do this I am 
> running one container called "workers" as it would normally be run during 
> development, i.e. not via a test runner. I have another container called 
> "foreman" that is run via a test runner which sets up the tests, sends work 
> to the "workers" container, and then make assertions about the work that 
> has been done. These two containers coordinate/communicate via a messaging 
> system (Celery) and the database (postgres). Therefore I am running the 
> "foreman" tests with the `--keepdb` option so the test database doesn't get 
> destroyed, then changing the settings for the "workers" container to use 
> "test_" .
>
> According to the docs 
> :
>  The 
> default test database names are created by prepending test_ to the value of 
> each NAME in DATABASES. Therefore I think that my "workers" container 
> should be using the same database as the "foreman", even though it is being 
> run by a test runner. However my issue is that the "workers" can't find any 
> of the database records inserted by the "foreman".
>
> I've tried to debug this by using the postgresql CLI to connect to the 
> test database, but even when I insert a record from the tests, enter an 
> infinite loop (so no cleanup code whatsoever will be run), and then check 
> the tables in the test database I do not see any records there.
>
> Does anyone know why I cannot seem to find any evidence of the test 
> database records from any interface other than an actively running test?
>
> Thanks in advance. I'm happy to share more details if needed, my project 
> is even open source so I can link the source code if someone wants to dig 
> that deep.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4d80cee-b324-4fa8-ada4-b237033656e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Database router with read replica

2017-08-30 Thread Matt Pegler
I'm hoping for some advice on how to utilize read replica databases with
Django.  I searched the django-users archive but didn't find much
discussion about this.  I also can't find many blog posts or discussion
elsewhere.  Do people have experience or general advice on using read
replicas with Django?

I am hoping to implement a database router that will intelligently use a
read replica while maintaining consistency despite replica lag.  I have a
couple things I'd like another opinion on:

First is handling replication lag.  Our read replica typically lags ~20ms
behind master, so we want to route all queries that occur after a write
within the same request to the master database.  I believe this can be
accomplished using a thread local in the database router that is reset
after each request using a middleware.  Does that seem like a reasonable
approach?

Second is handling atomic blocks.  As far as I can tell, Django will not
automatically route all queries within an atomic block to the same
database, so this needs to be handled within the router.  Is
connection.in_atomic_block

a
public API, or is there a better way to tell if we're within an atomic
block?

Thanks,
Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BSd1We3Yq37fYsZu1rVJcxizty6NNG4q-EeVp83wT7aeuh8pQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployement Apache

2017-08-30 Thread sarfaraz ahmed
Thanks Antonis,

I reached your website googling undoubtedly this is well explained. I have 
been able to deploy but here is my problem

STATIC_URL = '/static/'
MEDIA_URL = '/media/'


STATICFILES_DIRS = [os.path.join(BASE_DIR, 
"static"),os.path.join(BASE_DIR,"static","admin")]
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root')
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR),'media_root')

This is my settings in settingss.py 

Here is my vhost.conf files

WSGIPythonHome /usr/local/lib/python2.7/dist-packages


WSGIPythonPath /var/www/firsttest


ServerName firsttest.com
ServerAlias www.firsttest.com
ServerAdmin webmaster@localhost

WSGIScriptAlias / /var/www/firsttest/firsttest/wsgi.py

ErrorLog   /var/log/apache2/firsttest/first_error.log
CustomLog   /var/log/apache2/firsttest/first_access.log combined
Alias */static/admin /var/www/firsttest/static/admin*

Require all granted


Alias /static  */var/www/firsttest/static*

Require all granted




Require all granted




Now with this conf file everything works fine. CSS, js all works fine. 
However, you notice the conf file marked in red. its not actually pointing 
to my static_root folder which in settings defined as 
/var/www/static_root

static root is one which gathers all my static files when I run collect 
static

if I understand correctly from documentation. Web server should point to 
static root folder to access css files in production. 

Regards,
Sarfaraz Ahmed


 

On Wednesday, 30 August 2017 13:44:35 UTC+5:30, Antonis Christofides wrote:
>
> Hello Sarfaraz,
>
> You could try "How Django static files work in production 
> "
>  
> to get some understanding of the correct way to do it.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
> On 2017-08-28 06:17, sarfaraz ahmed wrote:
>
> Thanks for your help. Yes it was permission issue. However I am not able 
> to find anything under my site-packages. when I point the same to 
> dist-packages it works. 
>
> WSGIPythonHome /usr/local/lib/python2.7/dist-packages
> WSGIPythonPath /var/www/firsttest
>
> 
> ServerName firsttest.com
> ServerAlias www.firsttest.com
> ServerAdmin webmaster@localhost
>
> WSGIScriptAlias / /var/www/firsttest/firsttest/wsgi.py
>
> ErrorLog   /var/log/apache2/firsttest/first_error.log
> CustomLog   /var/log/apache2/firsttest/first_access.log combined
> Alias /static/admin/ 
> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/
> Alias /static/ /var/www/firsttest/static
> 
> 
> Require all granted
> 
> 
> 
>
> -
>
>
> This is my new conf file and it works. However I am still not able to see 
> my static files in admin. Any help would be appreciated.
>
>
> Regards
> Sarfaraz
>
> On Sunday, 27 August 2017 10:57:12 UTC+5:30, Vernon Swanepoel wrote: 
>>
>> Hello Sarfaraz, 
>>
>> A couple things you could look at:
>>
>>1. Are you including both your site-packages (eg 
>>python3.6/lib/site-packages) and your django project root (where you 
>>actually built the project) in your WSGIPythonPath?  String them together 
>>with a clone 
>>(/path/to/python3.6/lib/site-packages:/path/to/django/project/myproject) 
>>2. Your wsgi is within your django app 
>>(/path/to/django/project/myproject/myproject/wsgi...).  It sits in the 
>> same 
>>file as your settings.py.  Make sure it's pointing to the right place, 
>>because in your examples above your directory for django and your 
>> directory 
>>for the wsgi don't match. 
>>3. Have you set execute permissions all the way down the django app 
>>(using chmod +x /all/the/way/up/the/django/project/to/wsgi.py) 
>>
>> Deploying the first time is a frustrating process, and it's hard to get 
>> specific help because nobody knows exactly what you've got running, but if 
>> you stick with it, you'll get it working.
>>
>> Regards,
>> Vernon
>>
>> On Saturday, 26 August 2017 21:31:34 UTC+1, sarfaraz ahmed wrote: 
>>>
>>> Hey Team,
>>>
>>> Please someone help.
>>> I am still getting error
>>>
>>> * ImportError: No module named django.core.wsgi *mentioned below is my 
>>> latest vhost file in ubuntu. 
>>>
>>> 
>>> WSGIScriptAlias / /var/www/firstweb/firstweb/wsgi.py
>>> ServerName firstweb.com
>>>
>>> ServerAlias www.firstweb.com
>>> 
>>> 
>>> Require all granted
>>> 
>>> 
>>> CustomLog /var/log/apache2/firstweb-access.log combined
>>> ErrorLog 

get json sent to channels in view

2017-08-30 Thread Samuel Muiruri
I have this javascript code that send data to channels

// Note that the path doesn't matter for routing; any WebSocket
// connection gets bumped over to WebSocket consumers
socket = new WebSocket("ws://" + window.location.host + "/chat/");
socket.onmessage = function(e) {
alert(e.data);
}
socket.onopen = function() {
socket.send({"test":"data"});
}
// Call onopen directly if socket is already open
if (socket.readyState == WebSocket.OPEN) socket.onopen();

I'm curios how from message I can get the json {"test":"data"}

here's the view

# Connected to websocket.connect
@channel_session
def ws_connect(message, key):
# Accept connection
message.reply_channel.send({"accept": True})


​if i try message.content['test'] I get a key error

​key = message['test']
  File "/usr/local/lib/python2.7/dist-packages/channels/message.py", line
36, in __getitem__
return self.content[key]
KeyError: 'test'



-- 

Best Regards,

Samuel Muiruri.

Web Designer | +254 738 940064

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJZFZXpbC%2BZ9xSWumRVALKMnt29DkTLchUtKBvkBJyXBh43nQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Doubts about static files

2017-08-30 Thread mohammad k
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'firstdjango', 'static'),
)
STATIC_ROOT = '/Users/mk/Desktop/api/New folder/' : When you run
collectstatic files moves files from static files from static folder to
desktop.
add this settings to the settings.py

On Wed, Aug 30, 2017 at 6:28 PM, sarfaraz ahmed 
wrote:

>  Hello Team,
>
> I have doubts about static files. I read articles on Django but it does
> not clearly states that atleast I got confused.
>
> STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my
> STATICFILES_DIRS settings which points out to static folder under my
> project. Also, I can add all the folder from individual app which hold
> static files here so that it search for static files.
> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root') which
> points out to one level up folder than my project. This is how my project
> folder structures look like
>
> static_root
> MyProject
> --static
> CSS
> JS
> imgs
> --MyProject
> --MyApp
>
> When I run collectstatic files moves files from static files from static
> folder to static root.
>
> Now, my question is when deploy it on apache which folder should I point
> to in my conf files. static_root or static.
>
> Regards,
> Sarfaraz Ahmed
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0TyqO2exvH%3D4bs5wWEiwfogOszJdb0fq8Q3OiVhqLbK6Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Doubts about static files

2017-08-30 Thread mohammad k
move the static folder beside the settings.py

On Wed, Aug 30, 2017 at 6:32 PM, mohammad k  wrote:

> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, 'firstdjango', 'static'),
> )
> STATIC_ROOT = '/Users/mk/Desktop/api/New folder/' : When you run
> collectstatic files moves files from static files from static folder to
> desktop.
> add this settings to the settings.py
>
> On Wed, Aug 30, 2017 at 6:28 PM, sarfaraz ahmed 
> wrote:
>
>>  Hello Team,
>>
>> I have doubts about static files. I read articles on Django but it does
>> not clearly states that atleast I got confused.
>>
>> STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my
>> STATICFILES_DIRS settings which points out to static folder under my
>> project. Also, I can add all the folder from individual app which hold
>> static files here so that it search for static files.
>> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root')
>> which points out to one level up folder than my project. This is how my
>> project folder structures look like
>>
>> static_root
>> MyProject
>> --static
>> CSS
>> JS
>> imgs
>> --MyProject
>> --MyApp
>>
>> When I run collectstatic files moves files from static files from static
>> folder to static root.
>>
>> Now, my question is when deploy it on apache which folder should I point
>> to in my conf files. static_root or static.
>>
>> Regards,
>> Sarfaraz Ahmed
>>
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0TyzZ6RK9Ff2KofqS%2BdK%2B3iJU2R-GB8Wj4QcpMwsP0i3ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Doubts about static files

2017-08-30 Thread 'Kristofer Pettijohn' via Django users
Point Apache at static_root. 

Django apps you install may also include static files, and "collectstatic" 
gathers all of those together and puts them in one place (under STATIC_ROOT). 


From: "sarfaraz ahmed"  
To: "Django users"  
Sent: Wednesday, August 30, 2017 8:58:05 AM 
Subject: Doubts about static files 

Hello Team, 

I have doubts about static files. I read articles on Django but it does not 
clearly states that atleast I got confused. 

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my 
STATICFILES_DIRS settings which points out to static folder under my project. 
Also, I can add all the folder from individual app which hold static files here 
so that it search for static files. 
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root') which 
points out to one level up folder than my project. This is how my project 
folder structures look like 

static_root 
MyProject 
--static 
CSS 
JS 
imgs 
--MyProject 
--MyApp 

When I run collectstatic files moves files from static files from static folder 
to static root. 

Now, my question is when deploy it on apache which folder should I point to in 
my conf files. static_root or static. 

Regards, 
Sarfaraz Ahmed 







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [ mailto:django-users+unsubscr...@googlegroups.com | 
django-users+unsubscr...@googlegroups.com ] . 
To post to this group, send email to [ mailto:django-users@googlegroups.com | 
django-users@googlegroups.com ] . 
Visit this group at [ https://groups.google.com/group/django-users | 
https://groups.google.com/group/django-users ] . 
To view this discussion on the web visit [ 
https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com?utm_medium=email_source=footer
 | 
https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com
 ] . 
For more options, visit [ https://groups.google.com/d/optout | 
https://groups.google.com/d/optout ] . 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/36680093.1071353.1504101806381.JavaMail.zimbra%40cybernetik.net.
For more options, visit https://groups.google.com/d/optout.


Doubts about static files

2017-08-30 Thread sarfaraz ahmed
 Hello Team,

I have doubts about static files. I read articles on Django but it does not 
clearly states that atleast I got confused.

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my 
STATICFILES_DIRS settings which points out to static folder under my 
project. Also, I can add all the folder from individual app which hold 
static files here so that it search for static files.
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root') which 
points out to one level up folder than my project. This is how my project 
folder structures look like

static_root
MyProject
--static
CSS
JS
imgs
--MyProject
--MyApp

When I run collectstatic files moves files from static files from static 
folder to static root. 

Now, my question is when deploy it on apache which folder should I point to 
in my conf files. static_root or static. 

Regards,
Sarfaraz Ahmed





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bizarre URL behaviour after deploying

2017-08-30 Thread mohammad k
you have Different app in your project yes ?
you have to use app_name in url.py in each app

On Wed, Aug 30, 2017 at 4:11 PM, Bernd Wechner 
wrote:

> This has bamboozled me some. And the best thing I've found on-line doesn't
> seem to apply:
>
> https://stackoverflow.com/questions/26944908/django-url-
> mapping-how-to-remove-app-name-from-url-paths
>
> Let me summarise.
>
> I have a site that I've been building and testing with djangos development
> server of course. And it implements URLS like:
>
> http://127.0.0.1:8000/list/Model
> http://127.0.0.1:8000/add/Model
> http://127.0.0.1:8000/edit/Model/nn
> http://127.0.0.1:8000/view/Model/nn
> http://127.0.0.1:8000/delete/Model/nn
>
> Works like a dream, so I'm deploying, locally first, under lighttpd and
> uwsgi. That is working fine too. Sort of,
>
> These are all reached with links in my templates like yo:
>
> {% url 'list' model %}
> {% url 'add' model %}
> {% url 'edit' model pk %}
> {% url 'view' model pk %}
> {% url 'delete' model pk %}
>
> because in urls.py they all have "name"s defined like that.
>
> All honky dory.
>
> Now after deploying everything works nicely, but those same links point to:
>
> http://mysite.tld/app/list/Model
> http://mysite.tld/app/add/Model
> http://mysite.tld/app/edit/Model/nn
> http://mysite.tld/app/view/Model/nn
> http://mysite.tld/app/delete/Model/nn
>
> That is the app name is inserted. Odd. And undesired if not a crisis.
>
> But here's what bamboozles me. I can replace "app" in the url with any
> string at all, "x" say and the site continues to work but those URLs now
> point to :
>
> http://mysite.tld/x/list/Model
> http://mysite.tld/x/add/Model
> http://mysite.tld/x/edit/Model/nn
> http://mysite.tld/x/view/Model/nn
> http://mysite.tld/x/delete/Model/nn
>
> For what it's worth I don't want to quote urls.py and every other bit of
> possible config here of course, I am mainly interested to know if someone
> has insights that aren't shared in that SO link above as none of what is
> shared there seems to apply.
>
> For anyone really keen on code explorations urls.py is here:
>
> https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py
>
> and the whole site is there too.
>
> What I want to understand is why this "app" suddenly appears in my URLs
> and how I can control it (remove it ideally). But I have looked at urls.py
> long enough and scratched my head and not found it. settings.py is right
> next to if you need to inspect it.
>
> Kind regards,
>
> Bernd.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/c2b971d4-61be-e74f-e6bc-6f3ed8ce2a65%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0Tz1oBdnusZLeyHpcYSsVhSynKNOSsd%3DQdNoHuzQmkWdJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bizarre URL behaviour after deploying

2017-08-30 Thread mohammad k
i can't do that sorry man
Tell me more clearly, so I may help you better

On Wed, Aug 30, 2017 at 5:16 PM, Daniel Roseman 
wrote:

> On Wednesday, 30 August 2017 12:42:01 UTC+1, Bernd Wechner wrote:
>>
>> This has bamboozled me some. And the best thing I've found on-line
>> doesn't seem to apply:
>>
>> https://stackoverflow.com/questions/26944908/django-url-mapp
>> ing-how-to-remove-app-name-from-url-paths
>>
>> Let me summarise.
>>
>> I have a site that I've been building and testing with djangos
>> development server of course. And it implements URLS like:
>>
>> http://127.0.0.1:8000/list/Model
>> http://127.0.0.1:8000/add/Model
>> http://127.0.0.1:8000/edit/Model/nn
>> http://127.0.0.1:8000/view/Model/nn
>> http://127.0.0.1:8000/delete/Model/nn
>>
>> Works like a dream, so I'm deploying, locally first, under lighttpd and
>> uwsgi. That is working fine too. Sort of,
>>
>> These are all reached with links in my templates like yo:
>>
>> {% url 'list' model %}
>> {% url 'add' model %}
>> {% url 'edit' model pk %}
>> {% url 'view' model pk %}
>> {% url 'delete' model pk %}
>>
>> because in urls.py they all have "name"s defined like that.
>>
>> All honky dory.
>>
>> Now after deploying everything works nicely, but those same links point
>> to:
>>
>> http://mysite.tld/app/list/Model
>> http://mysite.tld/app/add/Model
>> http://mysite.tld/app/edit/Model/nn
>> http://mysite.tld/app/view/Model/nn
>> http://mysite.tld/app/delete/Model/nn
>>
>> That is the app name is inserted. Odd. And undesired if not a crisis.
>>
>> But here's what bamboozles me. I can replace "app" in the url with any
>> string at all, "x" say and the site continues to work but those URLs now
>> point to :
>>
>> http://mysite.tld/x/list/Model
>> http://mysite.tld/x/add/Model
>> http://mysite.tld/x/edit/Model/nn
>> http://mysite.tld/x/view/Model/nn
>> http://mysite.tld/x/delete/Model/nn
>>
>> For what it's worth I don't want to quote urls.py and every other bit of
>> possible config here of course, I am mainly interested to know if someone
>> has insights that aren't shared in that SO link above as none of what is
>> shared there seems to apply.
>>
>> For anyone really keen on code explorations urls.py is here:
>>
>> https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py
>>
>> and the whole site is there too.
>>
>> What I want to understand is why this "app" suddenly appears in my URLs
>> and how I can control it (remove it ideally). But I have looked at urls.py
>> long enough and scratched my head and not found it. settings.py is right
>> next to if you need to inspect it.
>>
>> Kind regards,
>>
>> Bernd.
>>
>
>
> How have you deployed this project? Can you show your deployment
> configuration?
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/8142e4c2-8a1b-4e6a-8bea-7f39416b1e61%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0TxrZWgNHyNENuA_V7Antg%2BbdTVCcv5mgywuu3KmHqGbxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bizarre URL behaviour after deploying

2017-08-30 Thread mohammad k
and in url.py beside settings.py use code like that :
url('^polls/',include('polls.urls')),

On Wed, Aug 30, 2017 at 4:29 PM, mohammad k  wrote:

> from django.conf.urls import url
> from . import views
>
> app_name = 'polls'
> urlpatterns = [
> url(r'^$', views.IndexView.as_view(), name='index'),
> url(r'^(?P[0-9]+)/$', views.DetailView.as_view(), name='detail'),
> url(r'^(?P[0-9]+)/results/$', views.ResultView.as_view(),
> name='results'),
> url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
> ]
>
> you have to create a url.py for each app in them folder
>
> On Wed, Aug 30, 2017 at 4:27 PM, mohammad k  wrote:
>
>> like that :
>> app_name = 'polls' in polls folder and in url.py
>>
>> On Wed, Aug 30, 2017 at 4:26 PM, mohammad k  wrote:
>>
>>> you have Different app in your project yes ?
>>> you have to use app_name in url.py in each app
>>>
>>> On Wed, Aug 30, 2017 at 4:11 PM, Bernd Wechner 
>>> wrote:
>>>
 This has bamboozled me some. And the best thing I've found on-line
 doesn't seem to apply:

 https://stackoverflow.com/questions/26944908/django-url-mapp
 ing-how-to-remove-app-name-from-url-paths

 Let me summarise.

 I have a site that I've been building and testing with djangos
 development server of course. And it implements URLS like:

 http://127.0.0.1:8000/list/Model
 http://127.0.0.1:8000/add/Model
 http://127.0.0.1:8000/edit/Model/nn
 http://127.0.0.1:8000/view/Model/nn
 http://127.0.0.1:8000/delete/Model/nn

 Works like a dream, so I'm deploying, locally first, under lighttpd and
 uwsgi. That is working fine too. Sort of,

 These are all reached with links in my templates like yo:

 {% url 'list' model %}
 {% url 'add' model %}
 {% url 'edit' model pk %}
 {% url 'view' model pk %}
 {% url 'delete' model pk %}

 because in urls.py they all have "name"s defined like that.

 All honky dory.

 Now after deploying everything works nicely, but those same links point
 to:

 http://mysite.tld/app/list/Model
 http://mysite.tld/app/add/Model
 http://mysite.tld/app/edit/Model/nn
 http://mysite.tld/app/view/Model/nn
 http://mysite.tld/app/delete/Model/nn

 That is the app name is inserted. Odd. And undesired if not a crisis.

 But here's what bamboozles me. I can replace "app" in the url with any
 string at all, "x" say and the site continues to work but those URLs now
 point to :

 http://mysite.tld/x/list/Model
 http://mysite.tld/x/add/Model
 http://mysite.tld/x/edit/Model/nn
 http://mysite.tld/x/view/Model/nn
 http://mysite.tld/x/delete/Model/nn

 For what it's worth I don't want to quote urls.py and every other bit
 of possible config here of course, I am mainly interested to know if
 someone has insights that aren't shared in that SO link above as none of
 what is shared there seems to apply.

 For anyone really keen on code explorations urls.py is here:

 https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py

 and the whole site is there too.

 What I want to understand is why this "app" suddenly appears in my URLs
 and how I can control it (remove it ideally). But I have looked at urls.py
 long enough and scratched my head and not found it. settings.py is right
 next to if you need to inspect it.

 Kind regards,

 Bernd.




 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/ms
 gid/django-users/c2b971d4-61be-e74f-e6bc-6f3ed8ce2a65%40gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0Tz0HjZegO3Ea3vYKyfj1XZSfAndh0ABhNaLn1bOVNnHKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bizarre URL behaviour after deploying

2017-08-30 Thread mohammad k
like that :
app_name = 'polls' in polls folder and in url.py

On Wed, Aug 30, 2017 at 4:26 PM, mohammad k  wrote:

> you have Different app in your project yes ?
> you have to use app_name in url.py in each app
>
> On Wed, Aug 30, 2017 at 4:11 PM, Bernd Wechner 
> wrote:
>
>> This has bamboozled me some. And the best thing I've found on-line
>> doesn't seem to apply:
>>
>> https://stackoverflow.com/questions/26944908/django-url-mapp
>> ing-how-to-remove-app-name-from-url-paths
>>
>> Let me summarise.
>>
>> I have a site that I've been building and testing with djangos
>> development server of course. And it implements URLS like:
>>
>> http://127.0.0.1:8000/list/Model
>> http://127.0.0.1:8000/add/Model
>> http://127.0.0.1:8000/edit/Model/nn
>> http://127.0.0.1:8000/view/Model/nn
>> http://127.0.0.1:8000/delete/Model/nn
>>
>> Works like a dream, so I'm deploying, locally first, under lighttpd and
>> uwsgi. That is working fine too. Sort of,
>>
>> These are all reached with links in my templates like yo:
>>
>> {% url 'list' model %}
>> {% url 'add' model %}
>> {% url 'edit' model pk %}
>> {% url 'view' model pk %}
>> {% url 'delete' model pk %}
>>
>> because in urls.py they all have "name"s defined like that.
>>
>> All honky dory.
>>
>> Now after deploying everything works nicely, but those same links point
>> to:
>>
>> http://mysite.tld/app/list/Model
>> http://mysite.tld/app/add/Model
>> http://mysite.tld/app/edit/Model/nn
>> http://mysite.tld/app/view/Model/nn
>> http://mysite.tld/app/delete/Model/nn
>>
>> That is the app name is inserted. Odd. And undesired if not a crisis.
>>
>> But here's what bamboozles me. I can replace "app" in the url with any
>> string at all, "x" say and the site continues to work but those URLs now
>> point to :
>>
>> http://mysite.tld/x/list/Model
>> http://mysite.tld/x/add/Model
>> http://mysite.tld/x/edit/Model/nn
>> http://mysite.tld/x/view/Model/nn
>> http://mysite.tld/x/delete/Model/nn
>>
>> For what it's worth I don't want to quote urls.py and every other bit of
>> possible config here of course, I am mainly interested to know if someone
>> has insights that aren't shared in that SO link above as none of what is
>> shared there seems to apply.
>>
>> For anyone really keen on code explorations urls.py is here:
>>
>> https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py
>>
>> and the whole site is there too.
>>
>> What I want to understand is why this "app" suddenly appears in my URLs
>> and how I can control it (remove it ideally). But I have looked at urls.py
>> long enough and scratched my head and not found it. settings.py is right
>> next to if you need to inspect it.
>>
>> Kind regards,
>>
>> Bernd.
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/c2b971d4-61be-e74f-e6bc-6f3ed8ce2a65%40gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0TxJLH8usGm%2B8sYCwcCp6A83T5ERZg5vXcYUpXJAPK2vZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bizarre URL behaviour after deploying

2017-08-30 Thread Daniel Roseman
On Wednesday, 30 August 2017 12:42:01 UTC+1, Bernd Wechner wrote:
>
> This has bamboozled me some. And the best thing I've found on-line doesn't 
> seem to apply:
>
> 
> https://stackoverflow.com/questions/26944908/django-url-mapping-how-to-remove-app-name-from-url-paths
>
> Let me summarise.
>
> I have a site that I've been building and testing with djangos development 
> server of course. And it implements URLS like:
>
> http://127.0.0.1:8000/list/Model
> http://127.0.0.1:8000/add/Model
> http://127.0.0.1:8000/edit/Model/nn
> http://127.0.0.1:8000/view/Model/nn
> http://127.0.0.1:8000/delete/Model/nn
>
> Works like a dream, so I'm deploying, locally first, under lighttpd and 
> uwsgi. That is working fine too. Sort of, 
>
> These are all reached with links in my templates like yo:
>
> {% url 'list' model %}
> {% url 'add' model %}
> {% url 'edit' model pk %}
> {% url 'view' model pk %}
> {% url 'delete' model pk %}
>
> because in urls.py they all have "name"s defined like that.
>
> All honky dory. 
>
> Now after deploying everything works nicely, but those same links point to:
>
> http://mysite.tld/app/list/Model
> http://mysite.tld/app/add/Model
> http://mysite.tld/app/edit/Model/nn
> http://mysite.tld/app/view/Model/nn
> http://mysite.tld/app/delete/Model/nn
>
> That is the app name is inserted. Odd. And undesired if not a crisis. 
>
> But here's what bamboozles me. I can replace "app" in the url with any 
> string at all, "x" say and the site continues to work but those URLs now 
> point to :
>
> http://mysite.tld/x/list/Model
> http://mysite.tld/x/add/Model
> http://mysite.tld/x/edit/Model/nn
> http://mysite.tld/x/view/Model/nn
> http://mysite.tld/x/delete/Model/nn
>
> For what it's worth I don't want to quote urls.py and every other bit of 
> possible config here of course, I am mainly interested to know if someone 
> has insights that aren't shared in that SO link above as none of what is 
> shared there seems to apply. 
>
> For anyone really keen on code explorations urls.py is here:
>
> https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py
>
> and the whole site is there too. 
>
> What I want to understand is why this "app" suddenly appears in my URLs 
> and how I can control it (remove it ideally). But I have looked at urls.py 
> long enough and scratched my head and not found it. settings.py is right 
> next to if you need to inspect it.
>
> Kind regards,
>
> Bernd.
>


How have you deployed this project? Can you show your deployment 
configuration?
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8142e4c2-8a1b-4e6a-8bea-7f39416b1e61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bizarre URL behaviour after deploying

2017-08-30 Thread Bernd Wechner
This has bamboozled me some. And the best thing I've found on-line 
doesn't seem to apply:


https://stackoverflow.com/questions/26944908/django-url-mapping-how-to-remove-app-name-from-url-paths

Let me summarise.

I have a site that I've been building and testing with djangos 
development server of course. And it implements URLS like:


http://127.0.0.1:8000/list/Model
http://127.0.0.1:8000/add/Model
http://127.0.0.1:8000/edit/Model/nn
http://127.0.0.1:8000/view/Model/nn
http://127.0.0.1:8000/delete/Model/nn

Works like a dream, so I'm deploying, locally first, under lighttpd and 
uwsgi. That is working fine too. Sort of,


These are all reached with links in my templates like yo:

{% url 'list' model %}
{% url 'add' model %}
{% url 'edit' model pk %}
{% url 'view' model pk %}
{% url 'delete' model pk %}

because in urls.py they all have "name"s defined like that.

All honky dory.

Now after deploying everything works nicely, but those same links point to:

http://mysite.tld/app/list/Model
http://mysite.tld/app/add/Model
http://mysite.tld/app/edit/Model/nn
http://mysite.tld/app/view/Model/nn
http://mysite.tld/app/delete/Model/nn

That is the app name is inserted. Odd. And undesired if not a crisis.

But here's what bamboozles me. I can replace "app" in the url with any 
string at all, "x" say and the site continues to work but those URLs now 
point to :


http://mysite.tld/x/list/Model
http://mysite.tld/x/add/Model
http://mysite.tld/x/edit/Model/nn
http://mysite.tld/x/view/Model/nn
http://mysite.tld/x/delete/Model/nn

For what it's worth I don't want to quote urls.py and every other bit of 
possible config here of course, I am mainly interested to know if 
someone has insights that aren't shared in that SO link above as none of 
what is shared there seems to apply.


For anyone really keen on code explorations urls.py is here:

https://github.com/bernd-wechner/CoGs/blob/master/CoGs/urls.py

and the whole site is there too.

What I want to understand is why this "app" suddenly appears in my URLs 
and how I can control it (remove it ideally). But I have looked at 
urls.py long enough and scratched my head and not found it. settings.py 
is right next to if you need to inspect it.


Kind regards,

Bernd.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c2b971d4-61be-e74f-e6bc-6f3ed8ce2a65%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Translation

2017-08-30 Thread mohammad k
read django-translatin-manager docs

On Wed, Aug 30, 2017 at 11:50 AM,  wrote:

> Hi,
>
> I have a django application developed with static files from AngularJS. I
> need to translate the site to French and give option to users to select
> language. I have used django-translatin-manager for loading translation
> entries using admin panel. But I don't know how to setup active language
> for the django site. Please help me on this. Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/fb457e34-150f-4d7a-94c9-bc75f1a39426%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACOk0TxTM9HC5J1x8ik02e%2BaVnEAuJKDWe%2BE1_nkhJydn5YGvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Translation

2017-08-30 Thread dineshkcube
Hi,

I have a django application developed with static files from AngularJS. I 
need to translate the site to French and give option to users to select 
language. I have used django-translatin-manager for loading translation 
entries using admin panel. But I don't know how to setup active language 
for the django site. Please help me on this. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fb457e34-150f-4d7a-94c9-bc75f1a39426%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTTP Error 403 - Forbidden occurs

2017-08-30 Thread Antonis Christofides
Hi,

Sometimes the Apache log file (something like /var/log/apache2/error.log, but it
may be /var/log/apache2/yourdomain-error.log) has an additional error message
that may help you track down the problem.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 2017-08-30 10:10, deepak gupta wrote:
> I have Django App
> Using Django 1.9, Apache 2.4.6
> Hosted on HTTPS
> Certificate is : Multi Domain Certificate: *.customer.mydomain.com
> 
>
> I am facing the Issue of HTTP Error 403 - Forbidden , The Web server is
> configured to not list contents of this directory or you do not have enough
> permission to access the resource.
>
> My .conf file is:
>
> Listen 80
> NameVirtualHost *:80
> 
> Redirect permanent / https://xxx.xx.mydomain.com
> 
> Listen 443
> NameVirtualHost *:443
> 
>     ServerName xxx.xx.mydomain.com:443 
>     SSLEngine on
>     SSLCertificateKeyFile /etc/apache2/ssl/private.key
>     SSLCertificateFile /etc/apache2/ssl/star.xx.mydomain.com.crt
>     SSLCertificateChainFile /etc/apache2/ssl/intermediates.ca-bundle
>     SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
>         Alias /static /opt/myproject/myproject/media
>          
>         
>                 Order allow,deny
>                 Allow from all
>                  Require all granted
>         
>         
>
>    WSGIDaemonProcess processgroupname
> python-path=/opt/myproject:/opt/virtualenv/lib/python2.7/site-packages
>    WSGIProcessGroup processgroupname
>    WSGIScriptAlias / /opt/myproject/myproject/wsgi.py
>    WSGIPassAuthorization On
> 
> Listen 8080
> NameVirtualHost *:8080
> 
>         Alias /static /opt/myproject/myproject/media
>          
>         
>                 Order allow,deny
>                 Allow from all
>                  Require all granted
>         
>         
>
>    WSGIDaemonProcess processname
> python-path=/opt/myproject:/opt/virtualenv/lib/python2.7/site-packages
>    WSGIProcessGroup processname
>    WSGIScriptAlias / /opt/myproject/myproject/wsgi.py
>    WSGIPassAuthorization On
> 
>
> Do any one has idea or solution on this issue
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%3DkbM2fQ7VC4Ygtn-62CTrKF73xX45j47eYVepZjb_%2BP7dBOg%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/834fdc7a-965c-74c4-94ad-9ae72d2edc23%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: send email using django

2017-08-30 Thread Antonis Christofides
Hello,

I've found it hard to make the free Gmail account work as a smarthost. I think
Google doesn't like it and doesn't support it, so even if you get it to work,
next month it may break. I'm using a paid email account at runbox.com, but I
believe there is a huge number of alternatives.

For further problems sending email you might get some ideas at
https://djangodeployment.com/2017/01/18/why-does-django-not-email-me-the-500-internal-server-error/.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 2017-08-30 10:41, vishnu bhand wrote:
> I'm trying to send email using django ,but i giving some authentiaction
> problem to gmail account ...
>
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/799a2add-4ee3-44e8-9668-dc8df7b3dc14%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/19474bf6-40d4-87c9-a1f7-562945c2628b%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Encapsulating Complex Business Logic in a Migraiton

2017-08-30 Thread Antonis Christofides
Hello,

Another option that might or might not work would be to violate the rule and do
refer to "current" models during the migration to version X, but thereafter
reset your migrations and only support migration to X+1 from X, not from earlier
versions. This would need detailed release notes about the migration procedure,
so whether it's a decent solution depends on your release management practices.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 2017-08-29 23:43, Matt S wrote:
> Standard practice is that you do not refer to "current" models (i.e. from
> app.models import MyModel) in a migration as the migration will break when
> that models changes. This means copying any model-specific code into the
> migration. This becomes impractical when the code needed for the migration
> spans multiple files and models.
>
> How can I encapsulate a complex chain of business logic involving multiple
> models in a migration? For example, if I have instance methods on ModelA which
> calls methods on ModelB, ModelB queries for ModelC and calls methods on it. If
> I use those methods as they exist on the models, the migration will eventually
> break when any of the involved Models' schema changes.
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a60b8ed4-a5a6-40c8-b959-17e2a3ec3363%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10d5171b-eb1a-de9a-6704-b9ade51fb3d5%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployement Apache

2017-08-30 Thread Antonis Christofides
Hello Sarfaraz,

You could try "How Django static files work in production
"
to get some understanding of the correct way to do it.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 2017-08-28 06:17, sarfaraz ahmed wrote:
> Thanks for your help. Yes it was permission issue. However I am not able to
> find anything under my site-packages. when I point the same to dist-packages
> it works.
>
> WSGIPythonHome /usr/local/lib/python2.7/dist-packages
> WSGIPythonPath /var/www/firsttest
>
> 
>     ServerName firsttest.com
>     ServerAlias www.firsttest.com
>     ServerAdmin webmaster@localhost
>
>     WSGIScriptAlias / /var/www/firsttest/firsttest/wsgi.py
>
>     ErrorLog   /var/log/apache2/firsttest/first_error.log
>     CustomLog   /var/log/apache2/firsttest/first_access.log combined
>     Alias /static/admin/
> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/
>     Alias /static/ /var/www/firsttest/static
>     
>     
>     Require all granted
>     
>     
> 
> -
>
>
> This is my new conf file and it works. However I am still not able to see my
> static files in admin. Any help would be appreciated.
>
>
> Regards
> Sarfaraz
>
> On Sunday, 27 August 2017 10:57:12 UTC+5:30, Vernon Swanepoel wrote:
>
> Hello Sarfaraz,
>
> A couple things you could look at:
>
>  1. Are you including both your site-packages (eg
> python3.6/lib/site-packages) and your django project root (where you
> actually built the project) in your WSGIPythonPath?  String them
> together with a clone
> 
> (/path/to/python3.6/lib/site-packages:/path/to/django/project/myproject)
>  2. Your wsgi is within your django app
> (/path/to/django/project/myproject/myproject/wsgi...).  It sits in the
> same file as your settings.py.  Make sure it's pointing to the right
> place, because in your examples above your directory for django and
> your directory for the wsgi don't match.
>  3. Have you set execute permissions all the way down the django app
> (using chmod +x /all/the/way/up/the/django/project/to/wsgi.py)
>
> Deploying the first time is a frustrating process, and it's hard to get
> specific help because nobody knows exactly what you've got running, but if
> you stick with it, you'll get it working.
>
> Regards,
> Vernon
>
> On Saturday, 26 August 2017 21:31:34 UTC+1, sarfaraz ahmed wrote:
>
> Hey Team,
>
> Please someone help.
> I am still getting error*ImportError: No module named django.core.wsgi
>
> *mentioned below is my latest vhost file in ubuntu.
>
> 
>     WSGIScriptAlias / /var/www/firstweb/firstweb/wsgi.py
>     ServerName firstweb.com 
>
>     ServerAlias www.firstweb.com 
>     
>     
>     Require all granted
>     
>     
>     CustomLog /var/log/apache2/firstweb-access.log combined
>     ErrorLog /var/log/apache2/firstweb-error.log
> 
>
> Earlier I missed WSGIScriptAlias argument.
>
> Regards,
> Sarfaraz Ahmed
>
>
>
> On Saturday, 26 August 2017 20:02:47 UTC+5:30, sarfaraz ahmed wrote:
>
> Hello Friends,
>
> Please help me with this.
>
> I am new to linux and I am attempting to deploy my trial app on
> AWS ubuntu server.
>
> my vhost file looks like this
> 
>     WSGIScriptAlias / /var/www/firstweb/firstweb/wsgi.py
>
>    WSGIPythonPath /var/www/firstweb
>     ServerName firstweb.com 
>
>     ServerAlias www.firstweb.com 
>     
>     
>     Require all granted
>     
>     
> 
>
> now when I add WSGIPythonPath.. my apache fails to restart.
>
> If I remove that that I get following error when I try to access
> this from my computer.
> ImportError: No module named django.core.wsgi
>
> Now, I searched on the web and found following link
> https://www.webforefront.com/django/setupapachewebserverwsgi.html
> 
> 
>  
> which has some solution which I am not able to understand so far.
>
> after wasting my time in attempting to deploy on windows server.
>   

Re: send email using django

2017-08-30 Thread Andréas Kühne
Hi,

First make sure that the settings for google smtp server sending are
correct. See
https://stackoverflow.com/questions/32301868/django-sending-email-with-google-smtp
for an example. There you can also see a setting called "Allow access to
less secure apps". This is an issue even when using some versions of
Outlook.

Regards,

Andréas

2017-08-30 9:41 GMT+02:00 vishnu bhand :

> I'm trying to send email using django ,but i giving some authentiaction
> problem to gmail account ...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/799a2add-4ee3-44e8-9668-dc8df7b3dc14%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCfmRegHpAvfFvAFsht13tot%2BKordfSYeaFZ-WXaDes_bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


send email using django

2017-08-30 Thread vishnu bhand
I'm trying to send email using django ,but i giving some authentiaction 
problem to gmail account ...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/799a2add-4ee3-44e8-9668-dc8df7b3dc14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HTTP Error 403 - Forbidden occurs

2017-08-30 Thread deepak gupta
I have Django App
Using Django 1.9, Apache 2.4.6
Hosted on HTTPS
Certificate is : Multi Domain Certificate: *.customer.mydomain.com

I am facing the Issue of HTTP Error 403 - Forbidden , The Web server is
configured to not list contents of this directory or you do not have enough
permission to access the resource.

My .conf file is:

Listen 80
NameVirtualHost *:80

Redirect permanent / https://xxx.xx.mydomain.com

Listen 443
NameVirtualHost *:443

ServerName xxx.xx.mydomain.com:443
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/private.key
SSLCertificateFile /etc/apache2/ssl/star.xx.mydomain.com.crt
SSLCertificateChainFile /etc/apache2/ssl/intermediates.ca-bundle
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
Alias /static /opt/myproject/myproject/media
 

Order allow,deny
Allow from all
 Require all granted



   WSGIDaemonProcess processgroupname
python-path=/opt/myproject:/opt/virtualenv/lib/python2.7/site-packages
   WSGIProcessGroup processgroupname
   WSGIScriptAlias / /opt/myproject/myproject/wsgi.py
   WSGIPassAuthorization On

Listen 8080
NameVirtualHost *:8080

Alias /static /opt/myproject/myproject/media
 

Order allow,deny
Allow from all
 Require all granted



   WSGIDaemonProcess processname
python-path=/opt/myproject:/opt/virtualenv/lib/python2.7/site-packages
   WSGIProcessGroup processname
   WSGIScriptAlias / /opt/myproject/myproject/wsgi.py
   WSGIPassAuthorization On


Do any one has idea or solution on this issue

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DkbM2fQ7VC4Ygtn-62CTrKF73xX45j47eYVepZjb_%2BP7dBOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.